diff --git a/build b/build index c24b6ae7..72f523f3 100644 --- a/build +++ b/build @@ -1 +1 @@ -38 \ No newline at end of file +39 \ No newline at end of file diff --git a/src/AP_WS_Connection.cpp b/src/AP_WS_Connection.cpp index c06ee57b..3559ac0d 100644 --- a/src/AP_WS_Connection.cpp +++ b/src/AP_WS_Connection.cpp @@ -76,13 +76,17 @@ namespace OpenWifi { } AP_WS_Connection::~AP_WS_Connection() { - poco_information(Logger_, fmt::format("DESTRUCTOR({}): Session={} Connection closed.", SerialNumber_, + poco_information(Logger_, fmt::format("DESTRUCTOR({}): 0 - Session={} Connection closed.", SerialNumber_, State_.sessionId)); std::lock_guard G(ConnectionMutex_); - EndConnection(); + poco_information(Logger_, fmt::format("DESTRUCTOR({}): 1 - Session={} Connection closed.", SerialNumber_, + State_.sessionId)); + EndConnection(false); + poco_information(Logger_, fmt::format("DESTRUCTOR({}): 2 - Session={} Connection closed.", SerialNumber_, + State_.sessionId)); } - void AP_WS_Connection::EndConnection() { + void AP_WS_Connection::EndConnection(bool Clean) { bool expectedValue=false; if (Dead_.compare_exchange_strong(expectedValue,true,std::memory_order_release,std::memory_order_relaxed)) { @@ -110,7 +114,8 @@ namespace OpenWifi { Cleanup.detach(); } - AP_WS_Server()->EndSession(State_.sessionId, SerialNumberInt_); + if(Clean) + AP_WS_Server()->EndSession(State_.sessionId, SerialNumberInt_); } } diff --git a/src/AP_WS_Connection.h b/src/AP_WS_Connection.h index b442ba94..90a8e3ac 100644 --- a/src/AP_WS_Connection.h +++ b/src/AP_WS_Connection.h @@ -30,7 +30,7 @@ namespace OpenWifi { Poco::Logger &L, std::pair R); ~AP_WS_Connection(); - void EndConnection(); + void EndConnection(bool Clean = true); void ProcessJSONRPCEvent(Poco::JSON::Object::Ptr &Doc); void ProcessJSONRPCResult(Poco::JSON::Object::Ptr Doc); void ProcessIncomingFrame();