Prevent the shared port from blocking on a socket whose deadlne has
already expired. #4314

The previous code made an error in assuming that the callback is invoked
only when data is available to read; actually, it's invoked when there's
data to read *or* when the socket deadline is expired (and hence the
associated state should be cleaned up and the action marked as failed).

While we're at it, make sure that we read the response from the local
daemon in a non-blocking manner.