From 6a1b2cada923547cd9c146b3c56cedba93e124a6 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 29 Jun 2005 15:25:08 +0000 Subject: [PATCH] Also call the connection handler callback if a connection attempt fails. Otherwise there's no way for the client to stop the event loop and/or retry. --- src/event.c | 3 +++ strophe.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/event.c b/src/event.c index 8b7655c..8306720 100644 --- a/src/event.c +++ b/src/event.c @@ -162,6 +162,9 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout) xmpp_debug(ctx, "xmpp", "connection failed"); conn->state = XMPP_STATE_DISCONNECTED; sock_close(conn->sock); + /* notify the connection handler */ + conn->conn_handler(conn, XMPP_CONN_FAIL, conn->error, + conn->stream_error, conn->userdata); break; } diff --git a/strophe.h b/strophe.h index 4f9944d..9b04ec5 100644 --- a/strophe.h +++ b/strophe.h @@ -91,7 +91,8 @@ typedef struct _xmpp_stanza_t xmpp_stanza_t; /* connect callback */ typedef enum { XMPP_CONN_CONNECT, - XMPP_CONN_DISCONNECT + XMPP_CONN_DISCONNECT, + XMPP_CONN_FAIL } xmpp_conn_event_t; typedef enum {