diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-02-22 21:42:24 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-02-22 21:42:24 +0100 |
commit | 99aba5667d0d7ba6657f9c175a9342126bc4b0f2 (patch) | |
tree | 2448f73a7e4129f1a8f9f51e230dd00111452a30 /src/main.cpp | |
parent | 61ca40fa0e6c819aa72f3f2364667c7b990855d4 (diff) | |
download | biboumi-99aba5667d0d7ba6657f9c175a9342126bc4b0f2.tar.gz biboumi-99aba5667d0d7ba6657f9c175a9342126bc4b0f2.tar.bz2 biboumi-99aba5667d0d7ba6657f9c175a9342126bc4b0f2.tar.xz biboumi-99aba5667d0d7ba6657f9c175a9342126bc4b0f2.zip |
Connection to servers does not block the process anymore
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 43dfe4b..9a9543d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,11 +66,6 @@ int main(int ac, char** av) Poller p; p.add_socket_handler(xmpp_component); - if (!xmpp_component->start()) - { - log_info("Exiting"); - return -1; - } // Install the signals used to exit the process cleanly, or reload the // config @@ -93,8 +88,10 @@ int main(int ac, char** av) sigaction(SIGUSR1, &on_sigusr, nullptr); sigaction(SIGUSR2, &on_sigusr, nullptr); + xmpp_component->start(); + const std::chrono::milliseconds timeout(-1); - while (p.poll(timeout) != -1 || !exiting) + while (p.poll(timeout) != -1) { // Check for empty irc_clients (not connected, or with no joined // channel) and remove them @@ -119,6 +116,8 @@ int main(int ac, char** av) } // If the only existing connection is the one to the XMPP component: // close the XMPP stream. + if (exiting && xmpp_component->is_connecting()) + xmpp_component->close(); if (exiting && p.size() == 1 && xmpp_component->is_document_open()) xmpp_component->close_document(); } |