]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal-remote: process events without delay
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 13 Mar 2015 04:02:28 +0000 (00:02 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 13 Mar 2015 04:26:02 +0000 (00:26 -0400)
commit043945b93824e33e040954612aaa934cd1a43a1b
treedc59c64dda33e9899760c0b796de1c5421bfbc50
parentf53f7c8fc43df4e38655f2a1f57777c5934fee06
journal-remote: process events without delay

journal-remote buffers input, and then parses it handling one journal entry at a time.
It was possible for useful data to be left in the buffer after some entries were
processesed. But all data would be already read from the fd, so there would be
no reason for the event loop to call the handler again. After some new data came in,
the handler would be called again, and would then process the "old" data in the buffer.

Fix this by enabling a handler wherever we process input data and do not exhaust data
from the input buffer (i.e. when EAGAIN was not encountered). The handler runs until
we encounter EAGAIN.

Looping over the input data is done in this roundabout way to allow the event loop
to dispatch other events in the meanwhile. If the loop was inside the handler, a
source which produced data fast enough could completely monopolize the process.

https://bugs.freedesktop.org/show_bug.cgi?id=89516
src/journal-remote/journal-remote-parse.c
src/journal-remote/journal-remote-parse.h
src/journal-remote/journal-remote.c