mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
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:
1 parent
44e7da6d56
commit
a1969efac1
5 files changed
+94
-51
No files matched your search
+3
-2
@@ -146,8 +146,9 @@ void link_server_set_authorizer(link_server_t *server, link_authorizer_t cb,
|
||||
/* Complete a deferred resolve and resume the parked call. Pass
|
||||
* (uid_t)-1 to say the caller could not be identified, which denies
|
||||
* it. Resolving a handle twice, or one whose connection has since
|
||||
* closed, does nothing. */
|
||||
void link_uid_resolved(link_server_t *server, link_authz_t tok, uid_t uid);
|
||||
* closed, does nothing. The connection is the one the resolver was
|
||||
* asked about; a reply callback is handed it as its first argument. */
|
||||
void link_uid_resolved(link_connection_t *conn, link_authz_t tok, uid_t uid);
|
||||
|
||||
/* Called with the reply to an outbound link_connection_call(). `reply`
|
||||
* is NULL if the connection dropped before one arrived. */
|
||||
|
||||
Reference in new issue
Block a user