Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3392548
D4100.id12999.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4100.id12999.diff
View Options
diff --git a/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h
--- a/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h
+++ b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h
@@ -27,6 +27,7 @@
bool isEmpty(const std::string deviceID);
DeliveryBrokerMessage pop(const std::string deviceID);
void erase(const std::string deviceID);
+ void deleteQueueIfEmpty(const std::string clientDeviceID);
};
} // namespace network
diff --git a/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp
--- a/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp
+++ b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp
@@ -66,5 +66,14 @@
this->messagesMap.erase(deviceID);
};
+void DeliveryBroker::deleteQueueIfEmpty(const std::string clientDeviceID) {
+ // If clientDeviceID messages queue is empty we don't need to store
+ // `folly::MPMCQueue` for it and need to free memory to fix possible 'ghost'
+ // queues.
+ if (DeliveryBroker::getInstance().isEmpty(clientDeviceID)) {
+ DeliveryBroker::getInstance().erase(clientDeviceID);
+ }
+};
+
} // namespace network
} // namespace comm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 9:08 AM (20 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604506
Default Alt Text
D4100.id12999.diff (1 KB)
Attached To
Mode
D4100: [services] Tunnelbroker - Introducing `deleteQueueIfEmpty` method for DeliveryBroker
Attached
Detach File
Event Timeline
Log In to Comment