daemon: Differentiate in logs between "client" and "caller"
A "caller" is a bus address that hasn't called `RegisterClient`. Prep for things like unifying the bus name tracking between the transaction and the daemon; right now it's a bit silly that the txn code also monitors the caller's bus name. So down the line we could change that code to call into the daemon and use its tracking for registered clients. Closes: #837 Approved by: jlebon
This commit is contained in:
parent
009e1f78d6
commit
46f4b62f3b
@ -180,8 +180,10 @@ on_active_txn_changed (GObject *object,
|
||||
g_variant_get (active_txn, "(&s&s&s)", &method, &sender, &path);
|
||||
if (*method)
|
||||
{
|
||||
gboolean is_registered = rpmostreed_daemon_has_client (self, sender);
|
||||
const char *caller_str = is_registered ? "client" : "caller";
|
||||
sd_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(RPMOSTREE_MESSAGE_TRANSACTION_STARTED),
|
||||
"MESSAGE=Initiated txn %s for caller %s: %s", method, sender, path,
|
||||
"MESSAGE=Initiated txn %s for %s %s: %s", method, caller_str, sender, path,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
@ -371,6 +373,13 @@ rpmostreed_daemon_add_client (RpmostreedDaemon *self,
|
||||
render_systemd_status (self);
|
||||
}
|
||||
|
||||
/* Return `TRUE` if the bus address @client called RegisterClient. */
|
||||
gboolean
|
||||
rpmostreed_daemon_has_client (RpmostreedDaemon *self, const char *client)
|
||||
{
|
||||
return g_hash_table_contains (self->bus_clients, client);
|
||||
}
|
||||
|
||||
void
|
||||
rpmostreed_daemon_remove_client (RpmostreedDaemon *self,
|
||||
const char *client)
|
||||
|
@ -31,6 +31,7 @@ GType rpmostreed_daemon_get_type (void) G_GNUC_CONST;
|
||||
RpmostreedDaemon * rpmostreed_daemon_get (void);
|
||||
void rpmostreed_daemon_add_client (RpmostreedDaemon *self, const char *client);
|
||||
void rpmostreed_daemon_remove_client (RpmostreedDaemon *self, const char *client);
|
||||
gboolean rpmostreed_daemon_has_client (RpmostreedDaemon *self, const char *client);
|
||||
void rpmostreed_daemon_exit_now (RpmostreedDaemon *self);
|
||||
void rpmostreed_daemon_run_until_idle_exit (RpmostreedDaemon *self);
|
||||
void rpmostreed_daemon_publish (RpmostreedDaemon *self,
|
||||
|
Loading…
Reference in New Issue
Block a user