The relay daemon's use of blocking network I/O can cause severe
performance degradation when interacting with unresponsive peers.
This patch changes the recvmsg() calls to use the MSG_DONTWAIT flag
which makes the call non-blocking. The connection classes are modified
to handle the partial reception of buffers.
The sendmsg() calls are still blocking, but this is assumed to
represent a fairly minimal risk of actually blocking given that
the control protocol's replies consist of 4-byte status codes.
A similar approach could be used to make the live connections
non-blocking as that side may also suffer from the same resiliancy
problems. So far, no users have reported this problem so it is
not prioritised.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>