libink: broker state belongs to the connection that has a broker

Parked calls and outbound calls awaiting a reply only ever happen on a
connection talking to a broker, but the parked array sat on the server
and the pending array on every connection.  A server with no broker
carried 4 KiB of slots it could never fill, and both were reachable
from code paths that have no business in them.

Move both behind one struct, allocated on the first park or call and
freed with the connection.  link_server_t goes from 4400 to 168 bytes;
link_connection_t barely moves, its buffers dominate, but an ordinary
peer no longer carries reply-tracking it never uses.

Tokens are now per bus rather than per server, so link_uid_resolved()
takes the connection the answer is about.  Every resolver already has
it: it is the first argument to both the resolver and the reply
callback.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-08-13 10:15:19 +02:00
1 parent 44e7da6d56
commit a1969efac1
5 files changed
+94 -51

No files matched your search

+1 -3
View File
@@ -1361,8 +1361,6 @@ static void uid_reply_cb(link_connection_t *conn, const link_reply_t *reply, voi
uid_t uid = (uid_t)-1;
uint32_t val;
(void)conn;
if (!reply) {
dbg("connection dropped before %s was identified", q->sender);
} else if (reply->type == LINK_MSG_METHOD_RETURN &&
@@ -1375,7 +1373,7 @@ static void uid_reply_cb(link_connection_t *conn, const link_reply_t *reply, voi
reply->error_name ? reply->error_name : "unexpected reply");
}
link_uid_resolved(server, q->tok, uid);
link_uid_resolved(conn, q->tok, uid);
free(q);
}