diff --git a/src/server/network/connection/connection.cpp b/src/server/network/connection/connection.cpp index 94535f588b0..96af21885cc 100644 --- a/src/server/network/connection/connection.cpp +++ b/src/server/network/connection/connection.cpp @@ -15,6 +15,7 @@ #include "server/network/protocol/protocol.hpp" #include "game/scheduling/dispatcher.hpp" #include "server/network/message/networkmessage.hpp" +#include "server/network/protocol/protocolgame.hpp" #include "server/server.hpp" #include "utils/tools.hpp" @@ -104,8 +105,7 @@ void Connection::closeSocket() { void Connection::accept(Protocol_ptr protocolPtr) { connectionState = CONNECTION_STATE_IDENTIFYING; - protocol = std::move(protocolPtr); - g_dispatcher().addEvent([protocol = protocol] { protocol->sendLoginChallenge(); }, __FUNCTION__, std::chrono::milliseconds(CONNECTION_WRITE_TIMEOUT * 1000).count()); + g_dispatcher().addEvent([protocol = std::move(protocolPtr)] { protocol->sendLoginChallenge(); }, __FUNCTION__, std::chrono::milliseconds(CONNECTION_WRITE_TIMEOUT * 1000).count()); acceptInternal(false); } diff --git a/src/server/network/connection/connection.hpp b/src/server/network/connection/connection.hpp index a40b6e0c018..5a1b94544d1 100644 --- a/src/server/network/connection/connection.hpp +++ b/src/server/network/connection/connection.hpp @@ -12,7 +12,6 @@ #include "declarations.hpp" // TODO: Remove circular includes (maybe shared_ptr?) #include "server/network/message/networkmessage.hpp" -#include "server/network/protocol/protocolgame.hpp" static constexpr int32_t CONNECTION_WRITE_TIMEOUT = 30; static constexpr int32_t CONNECTION_READ_TIMEOUT = 30;