GDBusWorker: tolerate read errors while closing
commit0f01bef4b458b73f2500ad8926b9c8a886215dc3
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 11 Nov 2011 14:41:50 +0000 (11 14:41 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 11 Nov 2011 16:05:21 +0000 (11 16:05 +0000)
tree38017428776bd5587421e15a9936f46b8bbf9751
parent214d249f40de028c5f76cea6ed665af5e1cf45d0
GDBusWorker: tolerate read errors while closing

My previous fix for GNOME#662100 was incomplete: it seems that with some
timings, the stream can be closed with an async read in-flight. This
can make the read fail immediately with G_IO_ERROR_CLOSED instead of
becoming cancelled.

This happens reliably on an embedded device, and rarely on my laptop;
repeating the test 100 times in quick succession reliably reproduces
the bug on my laptop.

It seems as though what we really want is to ignore read errors, once
we've established that we want to close the connection anyway - this
means that after asking to close, you're immune to exit-on-close,
which seems like a good rule.

An additional subtlety is that continuing to read after we know we
want to close is still required, otherwise we'll never emit ::closed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
gio/gdbusprivate.c