Ticket 48412 - worker threads do not detect abnormally closed
connections
Bug Description: If a connection is abnormally closed there can still be
data in the connection buffer(bytes vs offset). This prevents
the connection from being removed from the connection table.
The worker thread then goes into a loop trying to read this data
on an already closed connection. If there are enough abnormally
closed conenction eventually all the worker threads are stuck,
and new connections are not accepted.
Fix Description: When looking if there is more data in the buffer check if the
connection was closed, and return 0 (no more data).
Also did a little code cleanup.
https://fedorahosted.org/389/ticket/48412
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 30c4852a3d9ca527b78c0f89df5909bc9a268392)