sd-bus: start reply callback timeouts only when the connection is established
authorLennart Poettering <lennart@poettering.net>
Mon, 18 Dec 2017 12:53:12 +0000 (13:53 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2018 12:55:08 +0000 (13:55 +0100)
commitac8029fc251d989cf1d4c25f7125a4295513c765
tree654e7b9a9784d3b2f1f72a793cbc4252db3b6520
parent8a5cd31e5fa0b1313a196b902e4b3c4603e7dfdf
sd-bus: start reply callback timeouts only when the connection is established

Currently, reply callback timeouts are started the instant the method
calls are enqueued, which can be very early on. For example, the Hello()
method call is enqueued right when sd_bus_start() is called, i.e. before
the socket connection and everything is established.

With this change we instead start the method timeout the moment we
actually leave the authentication phase of the connection. This way, the
timeout the kernel applies on socket connecting, and we apply on the
authentication phase no longer runs in parallel to the Hello() method
call, but all three run serially one after the other, which is
definitely a cleaner approach.

Moreover, this makes the "watch bind" feature a lot more useful, as it
allows enqueuing method calls while we are still waiting for inotify
events, without them timeouting until the connection is actually
established, i.e. when the method call actually has a chance of being
actually run.

This is a change of behaviour of course, but I think the new behaviour
is much better than the old one, since we don't race timeouts against
each other anymore...
src/libsystemd/sd-bus/bus-internal.h
src/libsystemd/sd-bus/bus-slot.c
src/libsystemd/sd-bus/sd-bus.c