diff --git a/src/ConnectionProperties.cpp b/src/ConnectionProperties.cpp index 567bac83..485123de 100644 --- a/src/ConnectionProperties.cpp +++ b/src/ConnectionProperties.cpp @@ -18,12 +18,17 @@ with this program. If not, see #include "ConnectionProperties.h" +ConnectionProperties::ConnectionProperties() + : _authenticated(false) +{ +} + bool ConnectionProperties::isAuthenticated() { - return _authenticated; + return _authenticated.load(); } void ConnectionProperties::setAuthenticated(bool authenticated) { - _authenticated = authenticated; + _authenticated.store(authenticated); } \ No newline at end of file diff --git a/src/ConnectionProperties.h b/src/ConnectionProperties.h index 93d83270..5969fb88 100644 --- a/src/ConnectionProperties.h +++ b/src/ConnectionProperties.h @@ -18,11 +18,14 @@ with this program. If not, see #pragma once +#include + class ConnectionProperties { public: + explicit ConnectionProperties(); bool isAuthenticated(); void setAuthenticated(bool authenticated); private: - bool _authenticated; + boost::atomic _authenticated; }; \ No newline at end of file diff --git a/src/WSServer.cpp b/src/WSServer.cpp index f810216e..3b6e3db5 100644 --- a/src/WSServer.cpp +++ b/src/WSServer.cpp @@ -155,7 +155,6 @@ void WSServer::onOpen(connection_hdl hdl) { QMutexLocker locker(&_clMutex); _connections.insert(hdl); - _connectionProperties[hdl] = ConnectionProperties(); locker.unlock(); QString clientIp = getRemoteEndpoint(hdl);