fix(xmpp): clang-tidy warnings for extended debug info
Some checks failed
CI Code / Check spelling (pull_request) Successful in 23s
CI Code / Linux (ubuntu) (pull_request) Has been cancelled
CI Code / Check coding style (pull_request) Has been cancelled
CI Code / Linux (debian) (pull_request) Has been cancelled
CI Code / Linux (arch) (pull_request) Has been cancelled
Some checks failed
CI Code / Check spelling (pull_request) Successful in 23s
CI Code / Linux (ubuntu) (pull_request) Has been cancelled
CI Code / Check coding style (pull_request) Has been cancelled
CI Code / Linux (debian) (pull_request) Has been cancelled
CI Code / Linux (arch) (pull_request) Has been cancelled
This commit is contained in:
@@ -87,12 +87,12 @@ static gchar* profanity_instance_id = NULL;
|
||||
static gchar* prof_identifier = NULL;
|
||||
|
||||
// Extended debug tracking
|
||||
static time_t prof_last_connect_attempt_ts = 0; // when connection_connect was last called
|
||||
static time_t prof_last_successful_connect_ts = 0; // when we last transitioned to CONNECT/RAW_CONNECT
|
||||
static time_t prof_last_disconnect_ts = 0; // when we last transitioned to DISCONNECT
|
||||
static unsigned long prof_connect_attempt_counter = 0; // total calls to connection_connect
|
||||
static time_t prof_last_connect_attempt_ts = 0; // when connection_connect was last called
|
||||
static time_t prof_last_successful_connect_ts = 0; // when we last transitioned to CONNECT/RAW_CONNECT
|
||||
static time_t prof_last_disconnect_ts = 0; // when we last transitioned to DISCONNECT
|
||||
static unsigned long prof_connect_attempt_counter = 0; // total calls to connection_connect
|
||||
static unsigned long prof_successful_connect_counter = 0; // successful CONNECTs
|
||||
static unsigned long prof_reconnect_counter = 0; // times we forced a reconnect (XMPP_CONN_RECONNECT logic)
|
||||
static unsigned long prof_reconnect_counter = 0; // times we forced a reconnect (XMPP_CONN_RECONNECT logic)
|
||||
|
||||
// helper to format elapsed seconds (returns "n/a" if base == 0)
|
||||
char*
|
||||
@@ -1304,8 +1304,28 @@ connection_debug_print_features()
|
||||
}
|
||||
|
||||
// --- Extended debug accessors ---
|
||||
time_t connection_last_successful_connect_ts(void) { return prof_last_successful_connect_ts; }
|
||||
time_t connection_last_disconnect_ts(void) { return prof_last_disconnect_ts; }
|
||||
unsigned long connection_connect_attempts(void) { return prof_connect_attempt_counter; }
|
||||
unsigned long connection_successful_connects(void) { return prof_successful_connect_counter; }
|
||||
unsigned long connection_reconnect_counter(void) { return prof_reconnect_counter; }
|
||||
time_t
|
||||
connection_last_successful_connect_ts(void)
|
||||
{
|
||||
return prof_last_successful_connect_ts;
|
||||
}
|
||||
time_t
|
||||
connection_last_disconnect_ts(void)
|
||||
{
|
||||
return prof_last_disconnect_ts;
|
||||
}
|
||||
unsigned long
|
||||
connection_connect_attempts(void)
|
||||
{
|
||||
return prof_connect_attempt_counter;
|
||||
}
|
||||
unsigned long
|
||||
connection_successful_connects(void)
|
||||
{
|
||||
return prof_successful_connect_counter;
|
||||
}
|
||||
unsigned long
|
||||
connection_reconnect_counter(void)
|
||||
{
|
||||
return prof_reconnect_counter;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,8 @@ _iq_get_debug_stats(time_t* now_out, char* elapsed_connect, size_t len)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t last_success = connection_last_successful_connect_ts();
|
||||
if (now_out) *now_out = now;
|
||||
if (now_out)
|
||||
*now_out = now;
|
||||
_connection_format_elapsed_time(last_success, now, elapsed_connect, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ _session_get_debug_stats(time_t* now_out, char* elapsed_success, size_t success_
|
||||
time_t last_success = connection_last_successful_connect_ts();
|
||||
time_t last_disc = connection_last_disconnect_ts();
|
||||
|
||||
if (now_out) *now_out = now;
|
||||
if (now_out)
|
||||
*now_out = now;
|
||||
_connection_format_elapsed_time(last_success, now, elapsed_success, success_len);
|
||||
_connection_format_elapsed_time(last_disc, now, elapsed_disconnect, disconnect_len);
|
||||
}
|
||||
@@ -113,7 +114,7 @@ _session_get_debug_stats(time_t* now_out, char* elapsed_success, size_t success_
|
||||
// Helper function to log connection debug info
|
||||
static void
|
||||
_session_log_connect_debug(const char* event, const char* account, const char* jid,
|
||||
const char* server, int port, const char* tls_policy, const char* auth_policy)
|
||||
const char* server, int port, const char* tls_policy, const char* auth_policy)
|
||||
{
|
||||
time_t now;
|
||||
char elapsed_success[32];
|
||||
@@ -149,7 +150,7 @@ _session_log_state_debug(const char* event, int extra_param)
|
||||
// Helper function to log reconnect attempt
|
||||
static void
|
||||
_session_log_reconnect_debug(unsigned long attempt_num, const char* account, const char* jid,
|
||||
const char* server, unsigned short port, const char* tls_policy, const char* auth_policy)
|
||||
const char* server, unsigned short port, const char* tls_policy, const char* auth_policy)
|
||||
{
|
||||
time_t now;
|
||||
char elapsed_success[32];
|
||||
@@ -201,7 +202,7 @@ session_connect_with_account(const ProfAccount* const account)
|
||||
|
||||
log_info("Connecting using account: %s", account->name);
|
||||
_session_log_connect_debug("SESSION_CONNECT_WITH_ACCOUNT", account->name, account->jid,
|
||||
account->server, account->port, account->tls_policy, account->auth_policy);
|
||||
account->server, account->port, account->tls_policy, account->auth_policy);
|
||||
|
||||
_session_free_internals();
|
||||
|
||||
@@ -236,7 +237,7 @@ session_connect_with_details(const char* const jid, const char* const passwd, co
|
||||
assert(passwd != NULL);
|
||||
|
||||
_session_log_connect_debug("SESSION_CONNECT_WITH_DETAILS", NULL, jid,
|
||||
altdomain, port, tls_policy, auth_policy);
|
||||
altdomain, port, tls_policy, auth_policy);
|
||||
|
||||
_session_free_internals();
|
||||
|
||||
@@ -662,7 +663,7 @@ session_reconnect_now(void)
|
||||
|
||||
session_reconnect_attempt_counter++;
|
||||
_session_log_reconnect_debug(session_reconnect_attempt_counter, account->name, jid,
|
||||
server, port, account->tls_policy, account->auth_policy);
|
||||
server, port, account->tls_policy, account->auth_policy);
|
||||
|
||||
log_debug("Attempting reconnect with account %s", account->name);
|
||||
connection_connect(jid, saved_account.passwd, server, port, account->tls_policy, account->auth_policy);
|
||||
|
||||
Reference in New Issue
Block a user