diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/tcpserver.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/tcpserver.c b/net/tcpserver.c index 1e63e3b..5272029 100644 --- a/net/tcpserver.c +++ b/net/tcpserver.c @@ -1028,12 +1028,15 @@ static void tcpserver_free(t_tcpserver *x) for(i = 0; i < MAX_CONNECT; i++) { - if (x->x_sr[i]->sr_fd >= 0) - { - sys_rmpollfn(x->x_sr[i]->sr_fd); - sys_closesocket(x->x_sr[i]->sr_fd); + + if (NULL!=x->x_sr[i]) { + tcpserver_socketreceiver_free(x->x_sr[i]); + if (x->x_sr[i]->sr_fd >= 0) + { + sys_rmpollfn(x->x_sr[i]->sr_fd); + sys_closesocket(x->x_sr[i]->sr_fd); + } } - if (x->x_sr[i] != NULL) tcpserver_socketreceiver_free(x->x_sr[i]); } if (x->x_connectsocket >= 0) { |