mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
os: further simplify FlushClient
Since FlushClient only writes the data in the client's buffer, with no extra data or padding, we only write at most as many bytes as there are in the client buffer. we just have to set oco->count to notWritten, the amount we still have to write. Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
committed by
Enrico Weigelt
parent
1328254980
commit
808fc3a604
19
os/io.c
19
os/io.c
@@ -631,7 +631,7 @@ FlushAllOutput(void)
|
||||
continue;
|
||||
if (!client_is_ready(client)) {
|
||||
oc = (OsCommPtr) client->osPrivate;
|
||||
(void) FlushClient(client, oc);
|
||||
FlushClient(client, oc);
|
||||
} else
|
||||
NewOutputPending = TRUE;
|
||||
}
|
||||
@@ -932,19 +932,14 @@ FlushClient(ClientPtr who, OsCommPtr oc)
|
||||
the rest. */
|
||||
output_pending_mark(who);
|
||||
|
||||
if (written < oco->count) {
|
||||
if (written > 0) {
|
||||
oco->count -= written;
|
||||
memmove((char *) oco->buf,
|
||||
(char *) oco->buf + written, oco->count);
|
||||
written = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
written -= oco->count;
|
||||
oco->count = 0;
|
||||
if (written > 0) {
|
||||
oco->count -= written;
|
||||
memmove((char *) oco->buf,
|
||||
(char *) oco->buf + written, oco->count);
|
||||
written = 0;
|
||||
}
|
||||
|
||||
oco->count = notWritten;
|
||||
ospoll_listen(server_poll, oc->fd, X_NOTIFY_WRITE);
|
||||
|
||||
/* return only the amount explicitly requested */
|
||||
|
||||
Reference in New Issue
Block a user