From a86051b3193fe455c4515f6a2b3e44b06a0c7464 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 14 Aug 2012 20:53:32 +0200 Subject: [PATCH] Removed socket non-errors, added success message for opening listening sockets. --- lib/socket.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/socket.cpp b/lib/socket.cpp index 727f7de0..1e4458f7 100644 --- a/lib/socket.cpp +++ b/lib/socket.cpp @@ -203,9 +203,6 @@ signed int Socket::Connection::ready(){ } } if (r == 0){ - #if DEBUG >= 4 - fprintf(stderr, "Socket ready error - socket is closed.\n"); - #endif close(); return -1; } @@ -311,9 +308,6 @@ bool Socket::Connection::read(const void * buffer, int len){ }else{ if (r == 0){ Error = true; - #if DEBUG >= 2 - fprintf(stderr, "Could not read data! Socket is closed.\n"); - #endif close(); down += sofar; return false; @@ -354,9 +348,6 @@ int Socket::Connection::iwrite(const void * buffer, int len){ } } if (r == 0){ - #if DEBUG >= 4 - fprintf(stderr, "Could not iwrite data! Socket is closed.\n"); - #endif close(); } up += r; @@ -385,9 +376,6 @@ int Socket::Connection::iread(void * buffer, int len){ } } if (r == 0){ - #if DEBUG >= 4 - fprintf(stderr, "Could not iread data! Socket is closed.\n"); - #endif close(); } down += r; @@ -522,6 +510,9 @@ bool Socket::Server::IPv6bind(int port, std::string hostname, bool nonblock){ if (ret == 0){ ret = listen(sock, 100);//start listening, backlog of 100 allowed if (ret == 0){ + #if DEBUG >= 1 + fprintf(stderr, "IPv6 socket success @ %s:%i\n", hostname.c_str(), port); + #endif return true; }else{ #if DEBUG >= 1 @@ -571,6 +562,9 @@ bool Socket::Server::IPv4bind(int port, std::string hostname, bool nonblock){ if (ret == 0){ ret = listen(sock, 100);//start listening, backlog of 100 allowed if (ret == 0){ + #if DEBUG >= 1 + fprintf(stderr, "IPv4 socket success @ %s:%i\n", hostname.c_str(), port); + #endif return true; }else{ #if DEBUG >= 1