summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-03-24 20:31:02 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-03-24 20:31:02 +0100
commitffc820e234ebba39a0f04607f9a0fb044fe31b73 (patch)
tree66ece312b85f89b15e10c9f91444641d8e07c552 /src/main.cpp
parente196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb (diff)
downloadbiboumi-ffc820e234ebba39a0f04607f9a0fb044fe31b73.tar.gz
biboumi-ffc820e234ebba39a0f04607f9a0fb044fe31b73.tar.bz2
biboumi-ffc820e234ebba39a0f04607f9a0fb044fe31b73.tar.xz
biboumi-ffc820e234ebba39a0f04607f9a0fb044fe31b73.zip
Reconnected immediately to the XMPP whenever it closes the connection
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6b24662..d40c457 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -114,6 +114,17 @@ int main(int ac, char** av)
Logger::instance().reset();
reload.store(false);
}
+ // Reconnect to the XMPP server if this was not intended. This may have
+ // happened because we sent something invalid to it and it decided to
+ // close the connection. This is a bug that should be fixed, but we
+ // still reconnect automatically instead of dropping everything
+ if (!exiting && !xmpp_component->is_connected() &&
+ !xmpp_component->is_connecting())
+ {
+ xmpp_component->reset();
+ p.add_socket_handler(xmpp_component);
+ xmpp_component->start();
+ }
// If the only existing connection is the one to the XMPP component:
// close the XMPP stream.
if (exiting && xmpp_component->is_connecting())