mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
WebSocketSession: Add remoteAddress string
This commit is contained in:
parent
11913dac76
commit
53e773b1a2
@ -3,6 +3,7 @@
|
||||
#include "plugin-macros.generated.h"
|
||||
|
||||
WebSocketSession::WebSocketSession() :
|
||||
_remoteAddress(""),
|
||||
_connectedAt(0),
|
||||
_incomingMessages(0),
|
||||
_outgoingMessages(0),
|
||||
@ -16,6 +17,19 @@ WebSocketSession::WebSocketSession() :
|
||||
{
|
||||
}
|
||||
|
||||
std::string WebSocketSession::RemoteAddress()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_remoteAddressMutex);
|
||||
std::string ret(_remoteAddress);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WebSocketSession::SetRemoteAddress(std::string address)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_remoteAddressMutex);
|
||||
_remoteAddress = address;
|
||||
}
|
||||
|
||||
uint64_t WebSocketSession::ConnectedAt()
|
||||
{
|
||||
return _connectedAt.load();
|
||||
|
@ -9,6 +9,9 @@ class WebSocketSession
|
||||
public:
|
||||
WebSocketSession();
|
||||
|
||||
std::string RemoteAddress();
|
||||
void SetRemoteAddress(std::string address);
|
||||
|
||||
uint64_t ConnectedAt();
|
||||
void SetConnectedAt(uint64_t at);
|
||||
|
||||
@ -40,6 +43,8 @@ class WebSocketSession
|
||||
void SetEventSubscriptions(uint64_t subscriptions);
|
||||
|
||||
private:
|
||||
std::mutex _remoteAddressMutex;
|
||||
std::string _remoteAddress;
|
||||
std::atomic<uint64_t> _connectedAt;
|
||||
std::atomic<uint64_t> _incomingMessages;
|
||||
std::atomic<uint64_t> _outgoingMessages;
|
||||
|
Loading…
Reference in New Issue
Block a user