Skip to content
Snippets Groups Projects
Commit 2ab70ded authored by Peter Harris's avatar Peter Harris Committed by Alan Coopersmith
Browse files

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: default avatarPeter Harris <pharris@opentext.com>
parent f5b4b79d
No related branches found
No related tags found
1 merge request!426os: Restore buffer when writing to network
......@@ -790,7 +790,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
}
}
#endif
if (oco->count == 0 || oco->count + count + padBytes > oco->size) {
if ((oco->count == 0 && who->local) || oco->count + count + padBytes > oco->size) {
output_pending_clear(who);
if (!any_output_pending()) {
CriticalOutputPending = FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment