Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The socket will now be properly closed once all messages
have been sent.
  • Loading branch information
djarek committed Aug 1, 2015
1 parent 8a9b82e commit f478ec0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void Connection::close(bool force)
if (messageQueue.empty() || force) {
closeSocket();
} else {
//will be closed by the destructor
//will be closed by the destructor or onWriteOperation
}
}

Expand Down Expand Up @@ -312,6 +312,8 @@ void Connection::onWriteOperation(const boost::system::error_code& error)

if (!messageQueue.empty()) {
internalSend(messageQueue.front());
} else if (connectionState == CONNECTION_STATE_CLOSED) {
closeSocket();
}
}

Expand Down

0 comments on commit f478ec0

Please sign in to comment.