mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-22 21:51:51 +00:00
hanlders iterator
This commit is contained in:
1 parent
53bf068268
commit
fcd581ec6a
2 files changed
+14
-3
No files matched your search
@@ -67,9 +67,10 @@ namespace client
|
||||
{
|
||||
if(m_ConnectTimeout)
|
||||
m_ReadyTimer.cancel();
|
||||
std::unique_lock<std::mutex> l(m_HandlersMutex);
|
||||
for (auto it: m_Handlers)
|
||||
it->Terminate ();
|
||||
IterateHandlers ([](std::shared_ptr<I2PServiceHandler> handler)
|
||||
{
|
||||
if (handler) handler->Terminate ();
|
||||
});
|
||||
m_Handlers.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,16 @@ namespace client
|
||||
|
||||
virtual const char* GetName() const { return "Generic I2P Service"; }
|
||||
|
||||
protected:
|
||||
|
||||
template<typename Callback>
|
||||
void IterateHandlers (Callback&& callback)
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_HandlersMutex);
|
||||
for (auto it: m_Handlers)
|
||||
callback (it);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void TriggerReadyCheckTimer();
|
||||
|
||||
Reference in new issue
Block a user