patch for bad file descriptor on socket close when os=UNIX
Brought to you by:
lilyco
the CUDTUnited::RemoveSocket() function first closes the socket and then deletes the send and receive queues. but then the queue worker threads might make a call to the OS and give it a file descriptor that's already closed, which would cause an error. i am attaching a patch which solves this problem, by changing the order of function calls - first delete the queues and then close the socket.
note that to reproduce the problem you need to #define UNIX; it does not normally show when epoll is in use.
p.s. would appreciate if the author provides feedback if this patch is good or not