diff options
author | Rogier Polak <rogier.l.a.polak@gmail.com> | 2007-03-11 00:39:29 +0000 |
---|---|---|
committer | Rogier Polak <rogier.l.a.polak@gmail.com> | 2007-03-11 00:39:29 +0000 |
commit | 0a74cd8c92844e730cf6f56bdc3dd578c65a10d0 (patch) | |
tree | 8fc705e7b0b5edd35e82f53c3041a09a16eb09e5 /src/net/connectionhandler.cpp | |
parent | 8b56248ef58323c6e28264b5317d39c22c59db04 (diff) | |
download | manaserv-0a74cd8c92844e730cf6f56bdc3dd578c65a10d0.tar.gz manaserv-0a74cd8c92844e730cf6f56bdc3dd578c65a10d0.tar.bz2 manaserv-0a74cd8c92844e730cf6f56bdc3dd578c65a10d0.tar.xz manaserv-0a74cd8c92844e730cf6f56bdc3dd578c65a10d0.zip |
Added a utils::processor namespace and a function to determine if, the processor the program is running on, is little-endian or big-endian.
Diffstat (limited to 'src/net/connectionhandler.cpp')
-rw-r--r-- | src/net/connectionhandler.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp index 53ec3446..04bf0169 100644 --- a/src/net/connectionhandler.cpp +++ b/src/net/connectionhandler.cpp @@ -31,18 +31,6 @@ #include "script.h" #endif - -std::string -ip4ToString(unsigned int ip4addr) -{ - std::stringstream ss; - ss << (ip4addr & 0x000000ff) << "." - << ((ip4addr & 0x0000ff00) >> 8) << "." - << ((ip4addr & 0x00ff0000) >> 16) << "." - << ((ip4addr & 0xff000000) >> 24); - return ss.str(); -} - bool ConnectionHandler::startListen(enet_uint16 port) { // Bind the server to the default localhost. @@ -93,12 +81,11 @@ void ConnectionHandler::process(enet_uint32 timeout) switch (event.type) { case ENET_EVENT_TYPE_CONNECT: { - LOG_INFO("A new client connected from " << - ip4ToString(event.peer->address.host) << ":" << - event.peer->address.port << " to port " << - host->address.port); NetComputer *comp = computerConnected(event.peer); clients.push_back(comp); + LOG_INFO("A new client connected from " << *comp << ":" + << event.peer->address.port << " to port " + << host->address.port); // Store any relevant client information here. event.peer->data = (void *)comp; @@ -140,7 +127,7 @@ void ConnectionHandler::process(enet_uint32 timeout) case ENET_EVENT_TYPE_DISCONNECT: { NetComputer *comp = (NetComputer *)event.peer->data; - LOG_INFO(ip4ToString(event.peer->address.host) << " disconnected."); + LOG_INFO("" << *comp << " disconnected."); // Reset the peer's client information. computerDisconnected(comp); clients.erase(std::find(clients.begin(), clients.end(), comp)); |