mirror of
https://github.com/troglobit/finit.git
synced 2026-11-02 13:20:32 +00:00
libink/dbus: give parked and outstanding calls a deadline
A call is parked until the resolver says who sent it, and an outbound call sits in a pending slot until its reply lands. Neither had a way to give up. A broker that answers GetConnectionUnixUser slowly, or not at all, leaves the caller waiting forever and keeps the slot; four of those and every later privileged call is refused with LimitsExceeded until Finit restarts. libink cannot time itself out, it has no event loop, so the deadline is the embedder's to keep. One sweep per connection covers both, and the ordering between them stays in the library rather than in each embedder: calls first, because one timing out usually resolves the park it was made for, and AccessDenied tells that caller more than a bare timeout. The sweep is armed when a resolve is deferred and stops rearming as soon as nothing is outstanding, so a system that never meets a broker never wakes up for it. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
a1969efac1
commit
853e226812
6 files changed
+172
-5
No files matched your search
@@ -164,6 +164,18 @@ int link_connection_call(link_connection_t *conn, const char *destination,
|
||||
link_reply_cb_t cb, void *userdata,
|
||||
const char *signature, ...);
|
||||
|
||||
/* Nothing in libink runs a clock, it has no event loop, so calls that
|
||||
* go unanswered in either direction are the embedder's to time out.
|
||||
* This drops anything held longer than `age_ms` on one connection: a
|
||||
* park whose resolver never answered, which leaves its caller
|
||||
* org.freedesktop.DBus.Error.TimedOut, and a call whose reply never
|
||||
* came, whose callback runs once with a NULL reply exactly as a
|
||||
* dropped connection would.
|
||||
*
|
||||
* Returns how many are still outstanding, so a sweep can stop
|
||||
* rearming once nothing is left. */
|
||||
int link_connection_expire(link_connection_t *conn, unsigned int age_ms);
|
||||
|
||||
/* ---------- server / connection lifecycle ---------- */
|
||||
|
||||
/* Bind a listening socket at `path` with file mode `mode`, e.g. 0660
|
||||
|
||||
Reference in new issue
Block a user