From dba9f6e63eb01d889c551e3f59960d2b349fefd9 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 5 Oct 2022 16:36:58 +0200 Subject: Add debug output for connection errors --- net.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net.c b/net.c index 970ede8..e5d8285 100644 --- a/net.c +++ b/net.c @@ -71,10 +71,18 @@ static int roster_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, return 1; } -static void conn_handler(xmpp_conn_t *conn, xmpp_conn_event_t status,int error, - xmpp_stream_error_t *stream_error, void *userdata) { +static void conn_handler(xmpp_conn_t* conn, xmpp_conn_event_t status,int error, + xmpp_stream_error_t* stream_error, void* userdata) { // FIXME handle error and stream_error (this could be a major bug) + // this implements at least debugging: + if (error != 0) { + fprintf(stderr, "conn_handler got error=%d\n", error); + } + if (stream_error != NULL) { + fprintf(stderr, "conn_handler got stream_error of type %d\n", + stream_error->type); + } switch (status) { -- cgit v1.2.3-70-g09d2