do not remove the socket from the 'poll transport' for i/o pending errors

This commit is contained in:
bossiel 2015-06-11 08:52:26 +00:00
parent 737b492b69
commit a75e07604e
1 changed files with 10 additions and 4 deletions

View File

@ -553,7 +553,7 @@ void *tnet_transport_mainthread(void *param)
{ {
tnet_transport_t *transport = param; tnet_transport_t *transport = param;
transport_context_t *context = transport->context; transport_context_t *context = transport->context;
int ret; int ret, status;
tsk_size_t i; tsk_size_t i;
tsk_bool_t is_stream; tsk_bool_t is_stream;
tnet_fd_t fd; tnet_fd_t fd;
@ -777,9 +777,15 @@ void *tnet_transport_mainthread(void *param)
if(ret < 0){ if(ret < 0){
TSK_FREE(buffer); TSK_FREE(buffer);
status = tnet_geterrno();
// do not remove the socket for i/o pending errors
if (status == TNET_ERROR_WOULDBLOCK || status == TNET_ERROR_INPROGRESS || status == TNET_ERROR_EAGAIN) {
TSK_DEBUG_WARN("recv returned error code:%d", status);
}
else {
TNET_PRINT_LAST_ERROR("recv/recvfrom have failed");
removeSocket(i, context); removeSocket(i, context);
TNET_PRINT_LAST_ERROR("recv/recvfrom have failed."); }
goto TNET_POLLIN_DONE; goto TNET_POLLIN_DONE;
} }