# HG changeset patch # User Frank Zschockelt # Date 1557605684 -7200 # Node ID 7ae46452fb1078c1377c531adb6a07b051c218ab # Parent 866607b4c1868565ecde9469c4471341c038e4be Always signal a disconnect after connection_do_close() diff -r 866607b4c186 -r 7ae46452fb10 loudmouth/lm-connection.c --- a/loudmouth/lm-connection.c Sat May 04 18:24:41 2019 +0200 +++ b/loudmouth/lm-connection.c Sat May 11 22:14:44 2019 +0200 @@ -896,6 +896,15 @@ gboolean result, LmConnection *connection) { + /* FIXME: Set up according to XMPP 1.0 specification */ + /* StartTLS and the like */ + if (result == TRUE && !connection_send (connection, + "", -1, + NULL)) { + lm_verbose ("Failed to send xml version and encoding\n"); + result = FALSE; + } + if (result == FALSE) { connection_do_close (connection); @@ -909,21 +918,9 @@ _lm_utils_free_callback (cb); } - return; + } else { + connection_send_stream_header (connection); } - - /* FIXME: Set up according to XMPP 1.0 specification */ - /* StartTLS and the like */ - if (!connection_send (connection, - "", -1, - NULL)) { - lm_verbose ("Failed to send xml version and encoding\n"); - connection_do_close (connection); - - return; - } - - connection_send_stream_header (connection); } static gboolean @@ -969,6 +966,7 @@ if (!lm_connection_send (connection, m, NULL)) { lm_verbose ("Failed to send stream information\n"); connection_do_close (connection); + connection_signal_disconnect (connection, LM_DISCONNECT_REASON_ERROR); } lm_message_unref (m); @@ -1040,11 +1038,12 @@ lm_message_unref (m); if (result < 0) { connection_do_close (connection); + connection_signal_disconnect (connection, LM_DISCONNECT_REASON_ERROR); + } else { + /* We may finally tell the client they're authorized */ + connection_call_auth_cb (connection, TRUE); } - /* We may finally tell the client they're authorized */ - connection_call_auth_cb (connection, TRUE); - return LM_HANDLER_RESULT_REMOVE_MESSAGE; } @@ -1125,6 +1124,8 @@ g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, "%s: can't send resource binding request\n", G_STRFUNC); connection_do_close (connection); + connection_signal_disconnect (connection, + LM_DISCONNECT_REASON_ERROR); } } diff -r 866607b4c186 -r 7ae46452fb10 loudmouth/lm-feature-ping.c --- a/loudmouth/lm-feature-ping.c Sat May 04 18:24:41 2019 +0200 +++ b/loudmouth/lm-feature-ping.c Sat May 11 22:14:44 2019 +0200 @@ -193,13 +193,6 @@ if (priv->keep_alive_counter > 3) { g_signal_emit (fp, signals[TIMED_OUT], 0); return FALSE; - /* FIXME */ -#if 0 /* Should be moved to signal callback in LmConnection */ - connection_do_close (connection); - connection_signal_disconnect (connection, - LM_DISCONNECT_REASON_PING_TIME_OUT); -#endif - } server = _lm_connection_get_server (priv->connection);