feat(xmpp): add comprehensive connection debug logging

Add detailed debug output tracking connection lifecycle, autoping events,
and session state transitions with timestamps and counters.

- Track connection attempts, successes, disconnects, and reconnects
- Log autoping timer events, responses, and timeouts
- Record session login, logout, and reconnection attempts
- Add elapsed time calculations since key events
- Use [CONNDBG] tag for easy log filtering

Files: connection.c, iq.c, session.c, connection.h
This commit is contained in:
2025-11-20 11:36:56 +03:00
parent 74cfd32c1e
commit 12ae019394
4 changed files with 285 additions and 1 deletions

View File

@@ -37,6 +37,7 @@
#define XMPP_CONNECTION_H
#include "xmpp/xmpp.h"
#include <time.h>
#define CON_RAND_ID_LEN 15
@@ -68,4 +69,13 @@ void connection_remove_available_resource(const char* const resource);
char* connection_create_stanza_id(void);
// Extended debug accessors
time_t connection_last_successful_connect_ts(void);
time_t connection_last_disconnect_ts(void);
unsigned long connection_connect_attempts(void);
unsigned long connection_successful_connects(void);
unsigned long connection_reconnect_counter(void);
char* _connection_format_elapsed_time(time_t base, time_t now, char* buf, size_t len);
#endif