libink: a broker peer is not an ordinary client

libink was written peer to peer, where one connection is one client
and one principal.  Attaching to a message bus breaks both halves of
that, and two things followed from it.

Signals never reached the system bus.  Fan-out is gated on the peer
having sent AddMatch, but a broker subscribes for its own clients and
never sends us one, so every ServiceStateChanged was dropped on the
floor.  A connection attached with LINK_ATTACH_BROKER gets them all.

Hello, AddMatch and RemoveMatch write per-connection state.  Shared by
every caller behind a broker, that lets one sender exhaust the match
cap or drop another's rule, so we leave all three to the bus, whose
job they are.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-08-13 10:14:48 +02:00
1 parent abab0e0fd4
commit c71ccce742
6 files changed
+38 -9

No files matched your search

+6 -4
View File
@@ -187,12 +187,14 @@ int link_connection_emit_signal(link_connection_t *conn,
if (conn->auth != LINK_AUTH_DONE)
return 0; /* peer hasn't finished the SASL phase */
for (i = 0; i < conn->matches_count; i++) {
/* A broker routes to whoever subscribed with it, so it wants
* every signal and never sends us AddMatch of its own. */
matched = conn->broker;
for (i = 0; !matched && i < conn->matches_count; i++) {
if (__match_matches(conn->matches[i], path,
interface, member)) {
interface, member))
matched = 1;
break;
}
}
if (!matched)
return 0; /* peer didn't subscribe — nothing to do */