X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ee1709cd231588fe672d0bd2546ef69ee87ff88c..1cd2b12bd4e4d86f6cd099240795f3ebeb3852b3:/projects/stargazer/plugins/other/smux/smux.cpp diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index 8d5079bd..07f9d200 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -100,7 +100,6 @@ SMUX::SMUX() lastReconnectTry(0), reconnectTimeout(1), sock(-1), - addDelTariffNotifier(*this), logger(STG::PluginLogger::get("smux")) { smuxHandlers[SMUX_PDUs_PR_close] = &SMUX::CloseHandler; @@ -442,23 +441,24 @@ while (users->SearchNext(h, &u) == 0) users->CloseSearch(h); -m_onAddUserConn = users->onUserAdd([this](auto user){ +m_onAddUserConn = users->onAdd([this](auto user){ SetNotifier(user); UpdateTables(); }); -m_onDelUserConn = users->onUserDel([this](auto user){ +m_onDelUserConn = users->onDel([this](auto user){ UnsetNotifier(user); UpdateTables(); }); -tariffs->AddNotifierAdd(&addDelTariffNotifier); -tariffs->AddNotifierDel(&addDelTariffNotifier); +auto updateTables = [this](const STG::TariffData&){ UpdateTables(); }; +m_onAddTariffConn = tariffs->onAdd(updateTables); +m_onDelTariffConn = tariffs->onDel(updateTables); } void SMUX::ResetNotifiers() { -tariffs->DelNotifierDel(&addDelTariffNotifier); -tariffs->DelNotifierAdd(&addDelTariffNotifier); +m_onAddTariffConn.disconnect(); +m_onDelTariffConn.disconnect(); m_onAddUserConn.disconnect(); m_onDelUserConn.disconnect();