diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-02-19 23:59:43 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-02-19 23:59:43 +0100 |
commit | 16be9af3fcd23fa8590692cbe84af20cfe6a60b2 (patch) | |
tree | 9beefdc14b8d437d24e2e85ef41fb7eb539b7ef5 /src/network | |
parent | aeae88dd32b5130c87929fb0d0bf0f97a17286c2 (diff) | |
download | biboumi-16be9af3fcd23fa8590692cbe84af20cfe6a60b2.tar.gz biboumi-16be9af3fcd23fa8590692cbe84af20cfe6a60b2.tar.bz2 biboumi-16be9af3fcd23fa8590692cbe84af20cfe6a60b2.tar.xz biboumi-16be9af3fcd23fa8590692cbe84af20cfe6a60b2.zip |
Send unavailable presence to all muc when the IRC server closes the connection
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/poller.cpp | 6 | ||||
-rw-r--r-- | src/network/socket_handler.cpp | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/network/poller.cpp b/src/network/poller.cpp index 75e7e6a..010dd58 100644 --- a/src/network/poller.cpp +++ b/src/network/poller.cpp @@ -155,13 +155,15 @@ int Poller::poll(const std::chrono::milliseconds& timeout) else if (this->fds[i].revents & POLLIN) { auto socket_handler = this->socket_handlers.at(this->fds[i].fd); - socket_handler->on_recv(); + if (socket_handler->is_connected()) + socket_handler->on_recv(); nb_events--; } else if (this->fds[i].revents & POLLOUT) { auto socket_handler = this->socket_handlers.at(this->fds[i].fd); - socket_handler->on_send(); + if (socket_handler->is_connected()) + socket_handler->on_send(); nb_events--; } } diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp index ae9489d..580bba6 100644 --- a/src/network/socket_handler.cpp +++ b/src/network/socket_handler.cpp @@ -100,6 +100,7 @@ void SocketHandler::on_send() if (res == -1) { log_error("send failed: " << strerror(errno)); + this->on_connection_close(); this->close(); } else |