summaryrefslogtreecommitdiffstats
path: root/src/Net/Connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Net/Connection.cpp')
-rw-r--r--src/Net/Connection.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Net/Connection.cpp b/src/Net/Connection.cpp
index b9691cb..2f65bb0 100644
--- a/src/Net/Connection.cpp
+++ b/src/Net/Connection.cpp
@@ -47,7 +47,7 @@ void Connection::handleHandshake(const boost::system::error_code& error) {
{
boost::lock_guard<boost::shared_mutex> lock(connectionLock);
- state = CONNECTED;
+ _setState(CONNECTED);
receiving = false;
sending = 0;
@@ -64,10 +64,11 @@ void Connection::handleShutdown(const boost::system::error_code& error) {
boost::lock_guard<boost::shared_mutex> lock(connectionLock);
if(error) {
- // TODO Error
+ Common::Logger::logf(Common::Logger::VERBOSE, "Shutdown error: %s", error.message().c_str());
}
- state = DISCONNECTED;
+ _setState(DISCONNECTED);
+
ThreadManager::get()->pushWork(boost::bind((void (boost::signal0<void>::*)())&boost::signal0<void>::operator(), &disconnectedSignal));
}
@@ -223,7 +224,7 @@ void Connection::disconnect() {
if(!_isConnected() || _isDisconnecting())
return;
- state = DISCONNECT;
+ _setState(DISCONNECT);
if(sending)
return;
@@ -235,8 +236,7 @@ void Connection::disconnect() {
void Connection::doDisconnect() {
boost::lock_guard<boost::shared_mutex> lock(connectionLock);
- if(_isConnected())
- socket.async_shutdown(boost::bind(&Connection::handleShutdown, this, boost::asio::placeholders::error));
+ socket.async_shutdown(boost::bind(&Connection::handleShutdown, this, boost::asio::placeholders::error));
}
}