If socket is about to be closed do not add to [read|write]_set.
If NSG_CLOSE_IMMEDIATELY is on, then the socket will be closed, which means that (if the socket was added to either read_set or write_set) the subsequent select will in turn be performed on a socket that has been closed. Standard socket implementations seem to ignore a descriptor referring to a closed socket but LWIP (http://savannah.nongnu.org/projects/lwip/) crashes. So better not to add to the sets.
Showing
Please
register
or
sign in
to comment