aboutsummaryrefslogtreecommitdiff
path: root/src/BootstrapConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/BootstrapConnection.cpp')
-rw-r--r--src/BootstrapConnection.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp
index d914646..f09547e 100644
--- a/src/BootstrapConnection.cpp
+++ b/src/BootstrapConnection.cpp
@@ -127,6 +127,15 @@ namespace sibs
Log::warn("BootstrapConnection::receiveDataFromServer: No listener found for key '%s', ignoring...", pubsubKey.toString().c_str());
return;
}
+
+ for(auto existingPeer : subscribeDataIt->second.peers)
+ {
+ if(peer == existingPeer)
+ {
+ Log::debug("BootstrapConnection::receiveDataFromServer: Already connected to peer (ip: %s, port: %d)", peer->address.getAddress().c_str(), peer->address.getPort());
+ return;
+ }
+ }
subscribeDataIt->second.peers.push_back(peer);
Log::debug("BootstrapConnection::receiveDataFromServer: Connected to peer (ip: %s, port: %d) given by bootstrap node", peer->address.getAddress().c_str(), peer->address.getPort());
}