From ad8e8feaabb0a35e7e816340fae474d132483275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Mon, 27 Dec 2010 13:33:32 +0100 Subject: Also emit connection disconnected signal when we initiate the disconnect. diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp index 6ec8460..f3cf9a6 100644 --- a/Swiften/Network/BoostConnection.cpp +++ b/Swiften/Network/BoostConnection.cpp @@ -92,10 +92,10 @@ void BoostConnection::handleSocketRead(const boost::system::error_code& error, s eventLoop->postEvent(boost::bind(boost::ref(onDataRead), ByteArray(&readBuffer_[0], bytesTransferred)), shared_from_this()); doRead(); } - else if (error == boost::asio::error::eof) { + else if (error == boost::asio::error::eof || error == boost::asio::error::operation_aborted) { eventLoop->postEvent(boost::bind(boost::ref(onDisconnected), boost::optional<Error>()), shared_from_this()); } - else if (error != boost::asio::error::operation_aborted) { + else { eventLoop->postEvent(boost::bind(boost::ref(onDisconnected), ReadError), shared_from_this()); } } @@ -104,10 +104,10 @@ void BoostConnection::handleDataWritten(const boost::system::error_code& error) if (!error) { eventLoop->postEvent(boost::ref(onDataWritten), shared_from_this()); } - if (error == boost::asio::error::eof) { + else if (error == boost::asio::error::eof || error == boost::asio::error::operation_aborted) { eventLoop->postEvent(boost::bind(boost::ref(onDisconnected), boost::optional<Error>()), shared_from_this()); } - else if (error && error != boost::asio::error::operation_aborted) { + else { eventLoop->postEvent(boost::bind(boost::ref(onDisconnected), WriteError), shared_from_this()); } } -- cgit v0.10.2-6-g49f6