parent
5435dc638d
commit
5154280fd1
@ -1,23 +1,16 @@
|
|||||||
#include "host.hpp"
|
#include "host.hpp"
|
||||||
|
|
||||||
namespace sk {
|
namespace sk {
|
||||||
host::host(const std::string &ip, unsigned int connectionsMax)
|
host::host(const std::string &ip, unsigned int connectionsMax) : ip{ip}, connections{0}, connectionsMax{connectionsMax}, runners{} {}
|
||||||
: ip{ip}, connections{0}, connectionsMax{connectionsMax}, runners{} {}
|
|
||||||
|
|
||||||
void host::addConnection(sk::runner &runner) {
|
void host::addConnection(sk::runner &runner) {
|
||||||
runners.push(runner);
|
runners.push(runner);
|
||||||
connections += 1;
|
connections += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& host::getIp() const {
|
const std::string &host::getIp() const { return ip; }
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int host::getNbConnections() const {
|
unsigned int host::getNbConnections() const { return connections; }
|
||||||
return connections;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int host::getNbConnectionsMax() const {
|
unsigned int host::getNbConnectionsMax() const { return connectionsMax; }
|
||||||
return connectionsMax;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
#include "network.hpp"
|
#include "network.hpp"
|
||||||
|
|
||||||
namespace sk {
|
namespace sk {
|
||||||
uint32_t read_uint32(const char *buffer) {
|
uint32_t read_uint32(const char *buffer) { return static_cast<uint32_t>(buffer[3]) | static_cast<uint32_t>(buffer[2]) << 8 | static_cast<uint32_t>(buffer[1]) << 16 | static_cast<uint32_t>(buffer[0]) << 24; }
|
||||||
return static_cast<uint32_t>(buffer[3]) |
|
|
||||||
static_cast<uint32_t>(buffer[2]) << 8 |
|
|
||||||
static_cast<uint32_t>(buffer[1]) << 16 |
|
|
||||||
static_cast<uint32_t>(buffer[0]) << 24;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue