Skip to content

Commit

Permalink
WSS: log incoming IP addresses. [ds only] [skip appveyor]
Browse files Browse the repository at this point in the history
  • Loading branch information
geneotech committed May 8, 2024
1 parent c947707 commit 0afa06e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/application/masterserver/signalling_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class signalling_server {

void setup_server_callbacks() {
server.onClient([this](std::shared_ptr<rtc::WebSocket> client) {
LOG("New client connected.");
LOG("New client connected from address: %x", client->remoteAddress());

{
std::scoped_lock lk(active_connections_mutex);
Expand All @@ -76,7 +76,7 @@ class signalling_server {

client->onClosed([this, wclient = std::weak_ptr(client)]() {
if (auto client = wclient.lock()) {
LOG("client->onClosed");
LOG("(onClosed) Address: %x", client->remoteAddress());
std::scoped_lock lk(peers_mutex);
remove_web_peer(client);
}
Expand All @@ -86,6 +86,7 @@ class signalling_server {
LOG("Client WebSocket error: %x", err);

if (auto client = wclient.lock()) {
LOG("(onError) Address: %x", client->remoteAddress());
std::scoped_lock lk(peers_mutex);
remove_web_peer(client);
}
Expand Down Expand Up @@ -206,6 +207,9 @@ class signalling_server {
peers.erase(id);
dirty = true;
}
else {
LOG("remove_web_peer: Peer '%x' was not found in the map.", id);
}
}

void remove_web_peer(const std::shared_ptr<rtc::WebSocket>& ws) {
Expand Down

0 comments on commit 0afa06e

Please sign in to comment.