Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
beats-dh committed Dec 5, 2024
1 parent 5917f6a commit 0cb47e5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/network/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ Connection::Connection(asio::io_context &initIoService, ConstServicePort_ptr ini
socket(initIoService), m_msg() {
}

void Connection::close(bool force) {
void Connection::close(const bool force) {
const auto self = shared_from_this();
ConnectionManager::getInstance().releaseConnection(self);
ip = 0;

if (connectionState.load() == CONNECTION_STATE_CLOSED) {
if (connectionState.exchange(CONNECTION_STATE_CLOSED) == CONNECTION_STATE_CLOSED) {
return;
}
connectionState.store(CONNECTION_STATE_CLOSED);

if (protocol) {
auto weakProtocol = std::weak_ptr(protocol);
Expand Down Expand Up @@ -155,7 +154,7 @@ void Connection::acceptInternal(bool toggleParseHeader) {

readTimer.async_wait([weakSelf](const std::error_code &error) {
if (const auto self = weakSelf.lock()) {
Connection::handleTimeout(self, error);
handleTimeout(self, error);
}
});

Expand Down

0 comments on commit 0cb47e5

Please sign in to comment.