os: Restore buffer when writing to network

The commit 9bf46610 "os: Immediately
queue initial WriteToClient" effectively disables buffering (of all
writes, not just the "initial" write), since the OS's network buffers
will usually be large enough to hold whatever replies we have sent.

This does improve performance when drawing over a Unix socket (I measure
approximtely 10%, not the ~5x mentioned in that commit message, probably
due to the large changes in this area since that commit), but it
decreases performance when drawing over a network due to the additional
TCP packets. This decrease is small (~10%) in most cases, but if the two
machines have mismatched Nagle / tcp_delay settings it can cause
XGetWindowAttributes to take 200ms (because it's composed of two
requests, the 2nd of which might wait for the ack which is delayed).

Avoid network slowdowns by making the immediate flush conditional on
who->local.

Signed-off-by: Peter Harris <pharris@opentext.com>
4 jobs for buffer in 8 minutes and 7 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Docker Image
passed #2375911
debian-testing

00:00:41

 
  Build And Test
passed #2375912
autotools

00:07:25

passed #2375913
meson

00:03:44

passed #2375914
meson-noglamor

00:01:59