0.14.7: strophe 0.12: fix exit 1 on disconnect

With strophe 0.12, xmppipe printed an error "handle_connection:
disconnected" and exited with status 1 when the connection to the server
is closed.
master
Michael Santos 1 year ago
parent d8a6890873
commit f6c1fd34ca

@ -439,17 +439,24 @@ void handle_connection(xmpp_conn_t *const conn, const xmpp_conn_event_t status,
xmppipe_state_t *state = userdata; xmppipe_state_t *state = userdata;
switch (status) { switch (status) {
#ifdef XMPP_CONN_RAW_CONNECT
case XMPP_CONN_RAW_CONNECT:
#endif
case XMPP_CONN_CONNECT: case XMPP_CONN_CONNECT:
if (state->verbose) if (state->verbose)
fprintf(stderr, "DEBUG: connected\n"); fprintf(stderr, "DEBUG: connected\n");
xmppipe_next_state(state, XMPPIPE_S_CONNECTED); xmppipe_next_state(state, XMPPIPE_S_CONNECTED);
break; break;
default: case XMPP_CONN_DISCONNECT:
xmppipe_next_state(state, XMPPIPE_S_DISCONNECTED); xmppipe_next_state(state, XMPPIPE_S_DISCONNECTED);
if (state->verbose) if (state->verbose)
fprintf(stderr, "DEBUG: disconnected\n"); fprintf(stderr, "DEBUG: disconnected\n");
errx(EXIT_FAILURE, "handle_connection: disconnected"); break;
default:
xmppipe_next_state(state, XMPPIPE_S_DISCONNECTED);
errx(EXIT_FAILURE, "handle_connection: disconnected (%d)", status);
} }
} }

@ -27,7 +27,7 @@
#include "strtonum.h" #include "strtonum.h"
#endif #endif
#define XMPPIPE_VERSION "0.14.6" #define XMPPIPE_VERSION "0.14.7"
#define XMPPIPE_RESOURCE "xmppipe" #define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0) #define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0)

Loading…
Cancel
Save