parent
5435dc638d
commit
5154280fd1
@ -1,23 +1,16 @@
|
||||
#include "host.hpp"
|
||||
|
||||
namespace sk {
|
||||
host::host(const std::string &ip, unsigned int connectionsMax)
|
||||
: ip{ip}, connections{0}, connectionsMax{connectionsMax}, runners{} {}
|
||||
host::host(const std::string &ip, unsigned int connectionsMax) : ip{ip}, connections{0}, connectionsMax{connectionsMax}, runners{} {}
|
||||
|
||||
void host::addConnection(sk::runner& runner) {
|
||||
void host::addConnection(sk::runner &runner) {
|
||||
runners.push(runner);
|
||||
connections += 1;
|
||||
}
|
||||
|
||||
const std::string& host::getIp() const {
|
||||
return ip;
|
||||
}
|
||||
const std::string &host::getIp() const { return ip; }
|
||||
|
||||
unsigned int host::getNbConnections() const {
|
||||
return connections;
|
||||
}
|
||||
unsigned int host::getNbConnections() const { return connections; }
|
||||
|
||||
unsigned int host::getNbConnectionsMax() const {
|
||||
return connectionsMax;
|
||||
}
|
||||
unsigned int host::getNbConnectionsMax() const { return connectionsMax; }
|
||||
}
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "network.hpp"
|
||||
|
||||
namespace sk {
|
||||
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;
|
||||
}
|
||||
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; }
|
||||
}
|
||||
|
Loading…
Reference in new issue