Check for closed sockets before attempting a rpc

Ensure that the socket we've selected has been read from within a
second.  If it hasn't, check if it's closed by polling for readability
and if that works, MSG_PEEK'ing a single byte.  If we get eof, or an
error, we can assume it's broken.  This lets us avoid a large class of
transient network failures.
Maybe move this to be the first block after calling 'recv' to make it clear that there are no intervening calls that could alter errno? It is obvious by inspection now that that is not true, but someone maintaining the function later might not notice, and add something that could reset errno. Better to capture as early as possible.