diff --git a/src/i_socket.c b/src/i_socket.c index 10886b8..4e65e9e 100644 --- a/src/i_socket.c +++ b/src/i_socket.c @@ -57,7 +57,8 @@ TR_socketRecv(void * _this, size_t size) if (! remote_data) { switch (errno) { - case (EAGAIN|EWOULDBLOCK): + case EAGAIN: + // case EWOULDBLOCK: // is the same value as EAGAIN TR_delete(remote_data); return TR_emptyRemoteData; @@ -96,17 +97,25 @@ TR_socketSend(void * _this, TR_RemoteData data) // of the whole application... return -1; - case (EAGAIN|EWOULDBLOCK): + case EAGAIN: + //case EWOULDBLOCK: // is the same value as EAGAIN return FALSE; + default: case ECONNRESET: + case EPIPE: // this is a remote close... return -2; - - default: - return -2; } - } + } else if (size == 0) { + /* + * It might happen that a write returns 0. In that case the remote + * end was not ready to accept the data. This might be handled + * differently by the managing code so I return a separate value + * for this. + */ + return -3; + } return size; } diff --git a/src/socket_accept.c b/src/socket_accept.c index ef9b800..95ca50c 100644 --- a/src/socket_accept.c +++ b/src/socket_accept.c @@ -54,7 +54,6 @@ TR_socketAccept(TR_TcpSocket this) //fcntl(remote->handle, F_SETFL, flags | O_NONBLOCK); if (-1 == remote->handle) { - perror("accept"); TR_delete(remote); } else { TR_socketAddrIpStr(remote, remote->host, TR_MAX_HOST);