In the current architecture, all socket reads proceed before all socket
polls, and the socket poll is where the read timeout check is made. If
the sum of the execution time of all write and read handlers exceeds
that of the next timeout-enabled polled socket, the code would
incorrectly close due to a "timeout", even if some readable data became
available in the meantime. Fix by checking (via select()) one last time
and resetting the timer if the socket has some readable data.