Split off from !213 (closed).
recvmsg() doesn't necessarily read all available data from the socket, so call it in a loop until we've read all available data or filled the read buffer. This helps to avoid buffer bloat.
This is actually enough to fix weston#589 on its own.
I also included a small (non-functional) simplification to wl_connection_write().