Subject: | RC_WAIT causes sockets to leak |
When using a handler that returns RC_WAIT status in order to process
requests without blocking, the connection does not get properly cleaned
up when an error is detected (such as the remote side closing the
socket). After accepting and processing several connections, sockets
will pile up in CLOSE_WAIT until they hit ulimit -n, preventing the
server from accept()ing any new connections.
Sending all the data at once and returning RC_OK allows the connections
to be fully closed.