Cleaned up socket scheduling. Very clean now.

This commit is contained in:
Brad Arant committed 2022-03-15 21:02:35 +00:00
1 parent 4017ee9175
commit 3a6883e77f
8 files changed
+34 -45

No files matched your search

+4
View File
@@ -7,7 +7,9 @@ namespace core {
SubscriptionManager::SubscriptionManager() {}
int SubscriptionManager::add(Subscription &subscription) {
lock.lock();
subscriptions.insert(std::make_pair(subscription.id, &subscription));
lock.unlock();
return 1;
}
@@ -15,6 +17,7 @@ namespace core {
int countSubscribed = 0;
int countPublished = 0;
lock.lock();
std::string temp = "";
for(auto [key, subscription] : subscriptions) {
if(temp != "") {
@@ -34,6 +37,7 @@ namespace core {
}
coreutils::Log(coreutils::LOG_DEBUG_2) << "Removed session from " << countSubscribed << " subscription(s).";
coreutils::Log(coreutils::LOG_DEBUG_2) << "Cancelled " << countPublished << " channel(s) for session.";
lock.unlock();
return countSubscribed;
}