summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-02-03 19:37:49 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-02-03 19:37:49 (GMT)
commit42a1bbc568aab7e5b29c7fe16c13659291d01cae (patch)
treee554e83883497d7fdd6861c365204fa02380eedc /Swiften/Network/BoostConnection.cpp
parent5b9e776a70fa83aafa83a02ea1dc04c06f02734f (diff)
downloadswift-42a1bbc568aab7e5b29c7fe16c13659291d01cae.zip
swift-42a1bbc568aab7e5b29c7fe16c13659291d01cae.tar.bz2
Correct previous patch.
Diffstat (limited to 'Swiften/Network/BoostConnection.cpp')
-rw-r--r--Swiften/Network/BoostConnection.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index b6b2d9d..1d4bd32 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -79,11 +79,16 @@ void BoostConnection::disconnect() {
if (writing_) {
closeSocketAfterNextWrite_ = true;
} else {
- socket_.shutdown();
- socket_.close();
+ closeSocket();
}
}
+void BoostConnection::closeSocket() {
+ boost::system::error_code errorCode;
+ socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, errorCode);
+ socket_.close();
+}
+
void BoostConnection::write(const SafeByteArray& data) {
boost::lock_guard<boost::mutex> lock(writeMutex_);
if (!writing_) {
@@ -149,8 +154,7 @@ void BoostConnection::handleDataWritten(const boost::system::error_code& error)
if (writeQueue_.empty()) {
writing_ = false;
if (closeSocketAfterNextWrite_) {
- socket_.shutdown();
- socket_.close();
+ closeSocket();
}
}
else {