diff options
Diffstat (limited to 'server/src/tcpsocket.cc')
-rw-r--r-- | server/src/tcpsocket.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc index f748e0a..70722ed 100644 --- a/server/src/tcpsocket.cc +++ b/server/src/tcpsocket.cc @@ -90,12 +90,13 @@ TCPSocket::TCPSocket(std::string name, int sock) isconnected = false; this->sock = sock; - PRACRO_DEBUG(socket, "TCPSocket %s: %p %d (%d)\n", name.c_str(), this, sock, getpid()); + DEBUG(socket, "TCPSocket %s: %p %d (%d)\n", name.c_str(), this, sock, getpid()); } TCPSocket::~TCPSocket() { - PRACRO_DEBUG(socket, "~TCPSocket %s: %p %d (%d)\n", name.c_str(), this, sock, getpid()); + DEBUG(socket, "~TCPSocket %s: %p %d (%d)\n", + name.c_str(), this, sock, getpid()); disconnect(); } @@ -152,7 +153,7 @@ TCPSocket *TCPSocket::accept() FD_SET(sock, &fset); if( (ret = select (sock+1, &fset, NULL, NULL, NULL)) < 0) { if(errno == EINTR) { - PRACRO_DEBUG(socket, "Accept got interrupt!\n"); + DEBUG(socket, "Accept got interrupt!\n"); return NULL; // a signal caused select to return. That is OK with me } else { throw TCPAcceptException("Select on socket failed."); @@ -168,7 +169,8 @@ TCPSocket *TCPSocket::accept() child->isconnected = true; return child; } else { - PRACRO_ERR_LOG(socket, "Accept returned with no socket - This should not happen!\n"); + ERR_LOG(socket, + "Accept returned with no socket - This should not happen!\n"); return NULL; } } @@ -219,7 +221,8 @@ void TCPSocket::connect(std::string addr, unsigned short int port) void TCPSocket::disconnect() { if(sock != -1) { - PRACRO_DEBUG(socket, "Closing TCPSocket %s: %p %d (%d)\n", name.c_str(), this, sock, getpid()); + DEBUG(socket, "Closing TCPSocket %s: %p %d (%d)\n", + name.c_str(), this, sock, getpid()); int ret = close(sock); if(ret == -1) { perror(name.c_str()); @@ -269,7 +272,7 @@ int TCPSocket::read(char *buf, int size, long timeout) switch(ret) { case -1: if(errno == EINTR) { - PRACRO_DEBUG(socket, "EINTR - got interrupt\n"); + DEBUG(socket, "EINTR - got interrupt\n"); return -1; // a signal caused select to return. That is OK with me } else { throw TCPReadException("Select on socket (read) failed."); @@ -278,7 +281,7 @@ int TCPSocket::read(char *buf, int size, long timeout) case 0: // timeout - PRACRO_DEBUG(socket, "Timeout\n"); + DEBUG(socket, "Timeout\n"); break; default: @@ -288,7 +291,7 @@ int TCPSocket::read(char *buf, int size, long timeout) throw TCPReadException(strerror(errno)); } } else { - PRACRO_DEBUG(socket, "FD_ISSET failed (timeout?)\n"); + DEBUG(socket, "FD_ISSET failed (timeout?)\n"); return 0; } } |