mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Merge pull request #916 from oatpp/monitor_invalidate_all
network::monitor::ConnectionMonitor: invalidateAll() method
This commit is contained in:
commit
17ef2a7f6c
@ -198,6 +198,14 @@ void ConnectionMonitor::Monitor::removeConnection(v_uint64 id) {
|
||||
m_connections.erase(id);
|
||||
}
|
||||
|
||||
void ConnectionMonitor::Monitor::invalidateAll() {
|
||||
std::lock_guard<std::mutex> lock(m_connectionsMutex);
|
||||
for(v_uint64 caddr : m_connections) {
|
||||
auto connection = reinterpret_cast<ConnectionProxy*>(caddr);
|
||||
connection->invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionMonitor::Monitor::addStatCollector(const std::shared_ptr<StatCollector>& collector) {
|
||||
std::lock_guard<std::mutex> lock(m_checkMutex);
|
||||
m_statCollectors.insert({collector->metricName(), collector});
|
||||
@ -332,6 +340,10 @@ void ConnectionMonitor::addMetricsChecker(const std::shared_ptr<MetricsChecker>&
|
||||
m_monitor->addMetricsChecker(checker);
|
||||
}
|
||||
|
||||
void ConnectionMonitor::invalidateAll() {
|
||||
m_monitor->invalidateAll();
|
||||
}
|
||||
|
||||
void ConnectionMonitor::stop() {
|
||||
m_monitor->stop();
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ private:
|
||||
void freeConnectionStats(ConnectionStats& stats);
|
||||
void removeConnection(v_uint64 id);
|
||||
|
||||
void invalidateAll();
|
||||
|
||||
void addStatCollector(const std::shared_ptr<StatCollector>& collector);
|
||||
void removeStatCollector(const oatpp::String& metricName);
|
||||
|
||||
@ -147,6 +149,11 @@ public:
|
||||
*/
|
||||
void addMetricsChecker(const std::shared_ptr<MetricsChecker>& checker);
|
||||
|
||||
/**
|
||||
* Invalidate all currently active connections.
|
||||
*/
|
||||
void invalidateAll();
|
||||
|
||||
void stop() override;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user