aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BootstrapConnection.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp
index 421dfe1..e5f5178 100644
--- a/src/BootstrapConnection.cpp
+++ b/src/BootstrapConnection.cpp
@@ -6,6 +6,21 @@ namespace sibs
{
BootstrapConnection::BootstrapConnection(const Ipv4 &bootstrapAddress)
{
+ connections.onRemoveDisconnectedPeer([this](std::shared_ptr<DirectConnectionPeer> peer)
+ {
+ std::lock_guard<std::mutex> lock(subscribedPeersMutex);
+ for(auto &topicUsers : subscribedPeers)
+ {
+ for(auto it = topicUsers.second.begin(); it != topicUsers.second.end(); )
+ {
+ if(peer->address == (*it)->address)
+ it = topicUsers.second.erase(it);
+ else
+ ++it;
+ }
+ }
+ });
+
PubSubResult connectResult = PubSubResult::OK;
std::string connectResultStr;
bool connected = false;