Skip to content

Commit

Permalink
SBUS: additional details in debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tikhonov committed Aug 24, 2023
1 parent 56c33c6 commit 3606f87
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/sbus/connection/sbus_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sbus_connection_destructor(struct sbus_connection *conn)
sbus_connection_release(conn);

if (conn->destructor->destructor != NULL) {
DEBUG(SSSDBG_TRACE_FUNC, "Calling custom connection destructor %s\n",
DEBUG(SSSDBG_TRACE_FUNC, "Calling custom connection destructor '%s'\n",
conn->destructor->name);
conn->destructor->destructor(conn->destructor->data);
}
Expand Down Expand Up @@ -327,22 +327,34 @@ void _sbus_connection_set_destructor(struct sbus_connection *conn,
}

if (destructor == NULL) {
DEBUG(SSSDBG_TRACE_FUNC, "Unsetting connection destructor\n");
DEBUG(SSSDBG_TRACE_FUNC, "Unsetting connection %p ('%s':'%s') destructor\n",
conn,
conn->address ? conn->address : "-",
conn->wellknown_name ? conn->wellknown_name : "-");
conn->destructor->destructor = NULL;
conn->destructor->data = NULL;
conn->destructor->name = NULL;
return;
}

if (conn->destructor->destructor != NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Bug: destructor is already set to %s\n",
DEBUG(SSSDBG_CRIT_FAILURE,
"Bug: destructor for connection %p ('%s':'%s') is already set to '%s'\n",
conn,
conn->address ? conn->address : "-",
conn->wellknown_name ? conn->wellknown_name : "-",
conn->destructor->name);
return;
}

conn->destructor->destructor = destructor;
conn->destructor->data = data;
conn->destructor->name = name;
DEBUG(SSSDBG_TRACE_FUNC, "Set connection %p ('%s':'%s') destructor to '%s'\n",
conn,
conn->address ? conn->address : "-",
conn->wellknown_name ? conn->wellknown_name : "-",
name);
}

void _sbus_connection_set_access_check(struct sbus_connection *conn,
Expand Down Expand Up @@ -435,6 +447,7 @@ sbus_connection_free_handler(struct tevent_context *ev,
struct timeval tv,
void *data)
{
DEBUG(SSSDBG_TRACE_FUNC, "Actually releasing connection %p\n", data);
talloc_free(data);
}

Expand All @@ -453,8 +466,8 @@ void sbus_connection_free(struct sbus_connection *conn)
if (te == NULL) {
/* We can't do anything about it. */
DEBUG(SSSDBG_FATAL_FAILURE, "Failed to set up free event!\n");
} else {
DEBUG(SSSDBG_TRACE_ALL, "Connection %p will be freed during next loop!\n",
conn);
}

DEBUG(SSSDBG_TRACE_ALL, "Connection %p will be freed during next loop!\n",
conn);
}

0 comments on commit 3606f87

Please sign in to comment.