aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BootstrapConnection.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp
index a9ff5b8..f74129b 100644
--- a/src/BootstrapConnection.cpp
+++ b/src/BootstrapConnection.cpp
@@ -194,10 +194,12 @@ namespace sibs
it->second.listenCallbackFunc = callbackFunc;
return { pubsubKey };
}
- auto &data = subscribeData[pubsubKey];
+
+ SubscribeData data;
if(registerCallbackFunc)
data.listenCallbackFunc = callbackFunc;
data.listenStartTimeMs = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
+ subscribeData[pubsubKey] = data;
}
auto message = std::make_shared<Message>(MessageType::SUBSCRIBE);
@@ -250,8 +252,8 @@ namespace sibs
auto subscribeIt = subscribeData.find(pubsubKey);
if(subscribeIt == subscribeData.end())
{
- Log::warn("BootstrapConnection::put with no subscribers on same key '%s'", pubsubKey.toString().c_str());
- goto checkPutAttemptDuration;
+ Log::warn("BootstrapConnection::put: listen cancelled for '%s', stopping put attempts", pubsubKey.toString().c_str());
+ break;
}
listenStartTimeMs = subscribeIt->second.listenStartTimeMs;
@@ -275,7 +277,6 @@ namespace sibs
peersToMessage.clear();
}
- checkPutAttemptDuration:
const i64 half_min_ms = 1000 * 30;
i64 now = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
if(now - listenStartTimeMs > half_min_ms)