Commit 485a4cff4f5104ef316b6789e0e0ecd4ee5452e1

Authored by Georg Hopp
1 parent 63a22ebb

distinguish close and EAGAIN

... ... @@ -55,7 +55,7 @@ TR_socketRecv(void * _this, size_t size)
55 55
56 56 TR_RETCALL(_this, TR_Socket, recv, remote_data, size);
57 57
58   - if (((TR_SizedData)remote_data)->size < 0) {
  58 + if (! remote_data) {
59 59 switch (errno) {
60 60 case (EAGAIN|EWOULDBLOCK):
61 61 TR_delete(remote_data);
... ... @@ -75,7 +75,7 @@ TR_socketRecv(void * _this, size_t size)
75 75 } else if (((TR_SizedData)remote_data)->size == 0) {
76 76 // this is a remote close...
77 77 TR_delete(remote_data);
78   - return NULL;
  78 + return (void*)-1;
79 79 }
80 80
81 81 return remote_data;
... ...
... ... @@ -96,7 +96,7 @@ tcpSocketRecv(TR_Socket this, size_t size)
96 96 received = recv(this->handle, buffer, size, this->flags);
97 97
98 98 if (-1 == received) {
99   - rdata = TR_new(TR_RemoteData, NULL, received, this);
  99 + rdata = NULL;
100 100 } else {
101 101 rdata = TR_new(TR_RemoteData, buffer, received, this);
102 102 }
... ...
Please register or login to post a comment