user_recv_thread: set fd to -1 when closing (#461)
Fixes a busy loop of the usrsctp UDP recv thread attempting to shutdown
usrsctp with usrsctp_finish().
Usually, destroying the udp socket in recv_thread_destroy() would result
in the udp receive thread returning an error (-1) with errno set to
(-9) EDABF. In other cases, sometimes recvmsg would return 0 without an
error being reported in errno. My assumption here is that the fd number
would be reused for some other purpose.
Explicitly set the socket/fd variables to -1 when performing a
close()/closesocket() on them so that any future recv*() calls will
return with an error.
Also move the thread closure to the fd close block so that the threads
are definitley closed before we continue.
2 files changed