diff --git a/src/i_socket.c b/src/i_socket.c index 74a35eb..eb450c9 100644 --- a/src/i_socket.c +++ b/src/i_socket.c @@ -55,7 +55,7 @@ TR_socketRecv(void * _this, size_t size) TR_RETCALL(_this, TR_Socket, recv, remote_data, size); - if (((TR_SizedData)remote_data)->size < 0) { + if (! remote_data) { switch (errno) { case (EAGAIN|EWOULDBLOCK): TR_delete(remote_data); @@ -75,7 +75,7 @@ TR_socketRecv(void * _this, size_t size) } else if (((TR_SizedData)remote_data)->size == 0) { // this is a remote close... TR_delete(remote_data); - return NULL; + return (void*)-1; } return remote_data; diff --git a/src/tcp_socket.c b/src/tcp_socket.c index 77dba7b..491c2f8 100644 --- a/src/tcp_socket.c +++ b/src/tcp_socket.c @@ -96,7 +96,7 @@ tcpSocketRecv(TR_Socket this, size_t size) received = recv(this->handle, buffer, size, this->flags); if (-1 == received) { - rdata = TR_new(TR_RemoteData, NULL, received, this); + rdata = NULL; } else { rdata = TR_new(TR_RemoteData, buffer, received, this); }