git.stg.codes
/
stg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8582d7d
)
Simplify notifiers.
author
Maksym Mamontov
<madf@madf.info>
Tue, 23 Aug 2022 11:17:59 +0000
(14:17 +0300)
committer
Maksym Mamontov
<madf@madf.info>
Tue, 23 Aug 2022 11:17:59 +0000
(14:17 +0300)
16 files changed:
include/stg/notifer.h
patch
|
blob
|
history
include/stg/user_property.h
patch
|
blob
|
history
projects/stargazer/plugins/authorization/ao/ao.cpp
patch
|
blob
|
history
projects/stargazer/plugins/authorization/ao/ao.h
patch
|
blob
|
history
projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
patch
|
blob
|
history
projects/stargazer/plugins/other/ping/ping.cpp
patch
|
blob
|
history
projects/stargazer/plugins/other/ping/ping.h
patch
|
blob
|
history
projects/stargazer/plugins/other/rscript/rscript.cpp
patch
|
blob
|
history
projects/stargazer/plugins/other/rscript/rscript.h
patch
|
blob
|
history
projects/stargazer/plugins/other/smux/smux.h
patch
|
blob
|
history
projects/stargazer/tariffs_impl.cpp
patch
|
blob
|
history
projects/stargazer/traffcounter_impl.h
patch
|
blob
|
history
projects/stargazer/user_impl.cpp
patch
|
blob
|
history
projects/stargazer/user_impl.h
patch
|
blob
|
history
projects/stargazer/users_impl.cpp
patch
|
blob
|
history
tests/test_reconnect_on_tariff_change.cpp
patch
|
blob
|
history
diff --git
a/include/stg/notifer.h
b/include/stg/notifer.h
index 367c5ced998a111618d7d7aa9259905a8057be01..339b6170e1ae78514bf17dc206a60567dff7252b 100644
(file)
--- a/
include/stg/notifer.h
+++ b/
include/stg/notifer.h
@@
-3,20
+3,15
@@
namespace STG
{
namespace STG
{
-template <typename T>
-struct PropertyNotifierBase
-{
- virtual ~PropertyNotifierBase() = default;
-
- virtual void Notify(const T& oldValue, const T& newValue) = 0;
-};
-
-template <typename T>
+template <typename... Ts>
struct NotifierBase
{
virtual ~NotifierBase() = default;
struct NotifierBase
{
virtual ~NotifierBase() = default;
- virtual void
Notify(const T& value
) = 0;
+ virtual void
notify(const Ts&... values
) = 0;
};
};
+template <typename T>
+using PropertyNotifierBase = NotifierBase<T, T>;
+
}
}
diff --git
a/include/stg/user_property.h
b/include/stg/user_property.h
index 5965a7a6d0cbd0e3f373846e13c7a5509cbede66..529d854acd669b63b2d054fd36f61530f19f82e0 100644
(file)
--- a/
include/stg/user_property.h
+++ b/
include/stg/user_property.h
@@
-207,14
+207,14
@@
void UserProperty<T>::Set(const T& rvalue)
auto ni = beforeNotifiers.begin();
while (ni != beforeNotifiers.end())
auto ni = beforeNotifiers.begin();
while (ni != beforeNotifiers.end())
- (*ni++)->
N
otify(oldVal, rvalue);
+ (*ni++)->
n
otify(oldVal, rvalue);
value = rvalue;
modificationTime = time(NULL);
ni = afterNotifiers.begin();
while (ni != afterNotifiers.end())
value = rvalue;
modificationTime = time(NULL);
ni = afterNotifiers.begin();
while (ni != afterNotifiers.end())
- (*ni++)->
N
otify(oldVal, rvalue);
+ (*ni++)->
n
otify(oldVal, rvalue);
}
//-----------------------------------------------------------------------------
template <typename T>
}
//-----------------------------------------------------------------------------
template <typename T>
diff --git
a/projects/stargazer/plugins/authorization/ao/ao.cpp
b/projects/stargazer/plugins/authorization/ao/ao.cpp
index 7b6f129d40c7e672a202ab7317a6b33044e796a6..78e1c955e9cfc96278edfb270d71b1c295761466 100644
(file)
--- a/
projects/stargazer/plugins/authorization/ao/ao.cpp
+++ b/
projects/stargazer/plugins/authorization/ao/ao.cpp
@@
-211,7
+211,7
@@
return -1;
}
//-----------------------------------------------------------------------------
template <typename varParamType>
}
//-----------------------------------------------------------------------------
template <typename varParamType>
-void CHG_BEFORE_NOTIFIER<varParamType>::
N
otify(const varParamType &, const varParamType &)
+void CHG_BEFORE_NOTIFIER<varParamType>::
n
otify(const varParamType &, const varParamType &)
{
//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::Unauthorize, user);
if (user->IsAuthorizedBy(&auth))
{
//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::Unauthorize, user);
if (user->IsAuthorizedBy(&auth))
@@
-219,7
+219,7
@@
if (user->IsAuthorizedBy(&auth))
}
//-----------------------------------------------------------------------------
template <typename varParamType>
}
//-----------------------------------------------------------------------------
template <typename varParamType>
-void CHG_AFTER_NOTIFIER<varParamType>::
N
otify(const varParamType &, const varParamType &)
+void CHG_AFTER_NOTIFIER<varParamType>::
n
otify(const varParamType &, const varParamType &)
{
//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::UpdateUserAuthorization, user);
auth.UpdateUserAuthorization(user);
{
//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::UpdateUserAuthorization, user);
auth.UpdateUserAuthorization(user);
diff --git
a/projects/stargazer/plugins/authorization/ao/ao.h
b/projects/stargazer/plugins/authorization/ao/ao.h
index dbb2993a7c611eeb65d04ddafaa19e318e228c43..a97a09189019f6a0828531a64b65851c731e733c 100644
(file)
--- a/
projects/stargazer/plugins/authorization/ao/ao.h
+++ b/
projects/stargazer/plugins/authorization/ao/ao.h
@@
-51,7
+51,7
@@
public:
: user(u), auth(a) {}
CHG_BEFORE_NOTIFIER(const CHG_BEFORE_NOTIFIER<T> & rvalue)
: user(rvalue.user), auth(rvalue.auth) {}
: user(u), auth(a) {}
CHG_BEFORE_NOTIFIER(const CHG_BEFORE_NOTIFIER<T> & rvalue)
: user(rvalue.user), auth(rvalue.auth) {}
- void
Notify(const T & oldValue, const T & newValue)
;
+ void
notify(const T & oldValue, const T & newValue) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-68,7
+68,7
@@
public:
: user(u), auth(a) {}
CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER<T> & rvalue)
: user(rvalue.user), auth(rvalue.auth) {}
: user(u), auth(a) {}
CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER<T> & rvalue)
: user(rvalue.user), auth(rvalue.auth) {}
- void
Notify(const T & oldValue, const T & newValue)
;
+ void
notify(const T & oldValue, const T & newValue) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-125,7
+125,7
@@
private:
public:
explicit ADD_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
virtual ~ADD_USER_NONIFIER() {}
public:
explicit ADD_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
virtual ~ADD_USER_NONIFIER() {}
- void
Notify(const UserPtr & user)
{ auth.AddUser(user); }
+ void
notify(const UserPtr & user) override
{ auth.AddUser(user); }
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
@@
-138,7
+138,7
@@
private:
public:
explicit DEL_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
virtual ~DEL_USER_NONIFIER() {}
public:
explicit DEL_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
virtual ~DEL_USER_NONIFIER() {}
- void
Notify(const UserPtr & user)
{ auth.DelUser(user); }
+ void
notify(const UserPtr & user) override
{ auth.DelUser(user); }
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
diff --git
a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
index a5ce8aaf3c032b7e720be183f4327f19ef999331..f9137c20437446a691a900556c1ff02565f8f2cf 100644
(file)
--- a/
projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
+++ b/
projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
@@
-218,7
+218,7
@@
public:
explicit DEL_USER_NOTIFIER(AUTH_IA & a) : auth(a) {}
virtual ~DEL_USER_NOTIFIER() {}
explicit DEL_USER_NOTIFIER(AUTH_IA & a) : auth(a) {}
virtual ~DEL_USER_NOTIFIER() {}
- void
Notify(const UserPtr & user)
;
+ void
notify(const UserPtr & user) override
;
private:
DEL_USER_NOTIFIER(const DEL_USER_NOTIFIER & rvalue);
DEL_USER_NOTIFIER & operator=(const DEL_USER_NOTIFIER & rvalue);
private:
DEL_USER_NOTIFIER(const DEL_USER_NOTIFIER & rvalue);
DEL_USER_NOTIFIER & operator=(const DEL_USER_NOTIFIER & rvalue);
@@
-372,7
+372,7
@@
class UnauthorizeUser : std::unary_function<const std::pair<uint32_t, IA_USER> &
};
//-----------------------------------------------------------------------------
inline
};
//-----------------------------------------------------------------------------
inline
-void DEL_USER_NOTIFIER::
N
otify(const UserPtr & user)
+void DEL_USER_NOTIFIER::
n
otify(const UserPtr & user)
{
auth.DelUser(user);
}
{
auth.DelUser(user);
}
diff --git
a/projects/stargazer/plugins/other/ping/ping.cpp
b/projects/stargazer/plugins/other/ping/ping.cpp
index 260f4aefbc77c22efa303c41fb67630da6210883..352371202bb433f2526172662789a3291e936665 100644
(file)
--- a/
projects/stargazer/plugins/other/ping/ping.cpp
+++ b/
projects/stargazer/plugins/other/ping/ping.cpp
@@
-291,14
+291,14
@@
while (users_iter != usersList.end())
}
}
//-----------------------------------------------------------------------------
}
}
//-----------------------------------------------------------------------------
-void CHG_CURRIP_NOTIFIER_PING::
N
otify(const uint32_t & oldIP, const uint32_t & newIP)
+void CHG_CURRIP_NOTIFIER_PING::
n
otify(const uint32_t & oldIP, const uint32_t & newIP)
{
ping.pinger.DelIP(oldIP);
if (newIP != 0)
ping.pinger.AddIP(newIP);
}
//-----------------------------------------------------------------------------
{
ping.pinger.DelIP(oldIP);
if (newIP != 0)
ping.pinger.AddIP(newIP);
}
//-----------------------------------------------------------------------------
-void CHG_IPS_NOTIFIER_PING::
N
otify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS)
+void CHG_IPS_NOTIFIER_PING::
n
otify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS)
{
if (oldIPS.onlyOneIP())
ping.pinger.DelIP(oldIPS[0].ip);
{
if (oldIPS.onlyOneIP())
ping.pinger.DelIP(oldIPS[0].ip);
@@
-307,12
+307,12
@@
if (newIPS.onlyOneIP())
ping.pinger.AddIP(newIPS[0].ip);
}
//-----------------------------------------------------------------------------
ping.pinger.AddIP(newIPS[0].ip);
}
//-----------------------------------------------------------------------------
-void ADD_USER_NONIFIER_PING::
N
otify(const UserPtr & user)
+void ADD_USER_NONIFIER_PING::
n
otify(const UserPtr & user)
{
ping.AddUser(user);
}
//-----------------------------------------------------------------------------
{
ping.AddUser(user);
}
//-----------------------------------------------------------------------------
-void DEL_USER_NONIFIER_PING::
N
otify(const UserPtr & user)
+void DEL_USER_NONIFIER_PING::
n
otify(const UserPtr & user)
{
ping.DelUser(user);
}
{
ping.DelUser(user);
}
diff --git
a/projects/stargazer/plugins/other/ping/ping.h
b/projects/stargazer/plugins/other/ping/ping.h
index 6a82811224b9886b1a24e6fc56911adb153dc96c..ff66a1c261e74e5bd19442024a7ff353003653ab 100644
(file)
--- a/
projects/stargazer/plugins/other/ping/ping.h
+++ b/
projects/stargazer/plugins/other/ping/ping.h
@@
-31,7
+31,7
@@
class CHG_CURRIP_NOTIFIER_PING: public STG::PropertyNotifierBase<uint32_t> {
public:
CHG_CURRIP_NOTIFIER_PING(const PING & p, UserPtr u)
: user(u), ping(p) {}
public:
CHG_CURRIP_NOTIFIER_PING(const PING & p, UserPtr u)
: user(u), ping(p) {}
- void
Notify(const uint32_t & oldIP, const uint32_t & newIP)
;
+ void
notify(const uint32_t & oldIP, const uint32_t & newIP) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-45,7
+45,7
@@
class CHG_IPS_NOTIFIER_PING: public STG::PropertyNotifierBase<STG::UserIPs> {
public:
CHG_IPS_NOTIFIER_PING(const PING & p, UserPtr u)
: user(u), ping(p) {}
public:
CHG_IPS_NOTIFIER_PING(const PING & p, UserPtr u)
: user(u), ping(p) {}
- void
Notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS)
;
+ void
notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-58,7
+58,7
@@
private:
class ADD_USER_NONIFIER_PING: public STG::NotifierBase<UserPtr> {
public:
explicit ADD_USER_NONIFIER_PING(PING & p) : ping(p) {}
class ADD_USER_NONIFIER_PING: public STG::NotifierBase<UserPtr> {
public:
explicit ADD_USER_NONIFIER_PING(PING & p) : ping(p) {}
- void
Notify(const UserPtr & user)
;
+ void
notify(const UserPtr & user) override
;
private:
ADD_USER_NONIFIER_PING(const ADD_USER_NONIFIER_PING &);
private:
ADD_USER_NONIFIER_PING(const ADD_USER_NONIFIER_PING &);
@@
-70,7
+70,7
@@
private:
class DEL_USER_NONIFIER_PING: public STG::NotifierBase<UserPtr> {
public:
explicit DEL_USER_NONIFIER_PING(PING & p) : ping(p) {}
class DEL_USER_NONIFIER_PING: public STG::NotifierBase<UserPtr> {
public:
explicit DEL_USER_NONIFIER_PING(PING & p) : ping(p) {}
- void
Notify(const UserPtr & user)
;
+ void
notify(const UserPtr & user) override
;
private:
DEL_USER_NONIFIER_PING(const DEL_USER_NONIFIER_PING &);
private:
DEL_USER_NONIFIER_PING(const DEL_USER_NONIFIER_PING &);
diff --git
a/projects/stargazer/plugins/other/rscript/rscript.cpp
b/projects/stargazer/plugins/other/rscript/rscript.cpp
index e675d4886c56460ca234a3b78468f164f3c12dd4..7f0f4bc4d74f4618738b7af9173b81f24f7df6a8 100644
(file)
--- a/
projects/stargazer/plugins/other/rscript/rscript.cpp
+++ b/
projects/stargazer/plugins/other/rscript/rscript.cpp
@@
-522,7
+522,7
@@
if (it != authorizedUsers.end())
}*/
}
//-----------------------------------------------------------------------------
}*/
}
//-----------------------------------------------------------------------------
-void RS::IP_NOTIFIER::
N
otify(const uint32_t & /*oldValue*/, const uint32_t & newValue)
+void RS::IP_NOTIFIER::
n
otify(const uint32_t & /*oldValue*/, const uint32_t & newValue)
{
if (newValue != 0)
rs.AddRSU(user);
{
if (newValue != 0)
rs.AddRSU(user);
@@
-530,7
+530,7
@@
else
rs.DelRSU(user);
}
//-----------------------------------------------------------------------------
rs.DelRSU(user);
}
//-----------------------------------------------------------------------------
-void RS::CONNECTED_NOTIFIER::
N
otify(const bool & /*oldValue*/, const bool & newValue)
+void RS::CONNECTED_NOTIFIER::
n
otify(const bool & /*oldValue*/, const bool & newValue)
{
if (newValue)
rs.AddRSU(user);
{
if (newValue)
rs.AddRSU(user);
diff --git
a/projects/stargazer/plugins/other/rscript/rscript.h
b/projects/stargazer/plugins/other/rscript/rscript.h
index 6c97b59883cb188392867ba847ee9911f83fd238..fc95710894507e737e82ef42b6bde923f7dc1aa1 100644
(file)
--- a/
projects/stargazer/plugins/other/rscript/rscript.h
+++ b/
projects/stargazer/plugins/other/rscript/rscript.h
@@
-63,7
+63,7
@@
class ADD_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
public:
explicit ADD_USER_NONIFIER(REMOTE_SCRIPT & r)
: rs(r) {}
public:
explicit ADD_USER_NONIFIER(REMOTE_SCRIPT & r)
: rs(r) {}
- void
Notify(const UserPtr & user)
;
+ void
notify(const UserPtr & user) override
;
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rhs);
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rhs);
@@
-76,7
+76,7
@@
class DEL_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
public:
explicit DEL_USER_NONIFIER(REMOTE_SCRIPT & r)
: rs(r) {}
public:
explicit DEL_USER_NONIFIER(REMOTE_SCRIPT & r)
: rs(r) {}
- void
Notify(const UserPtr & user)
;
+ void
notify(const UserPtr & user) override
;
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rhs);
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rhs);
@@
-101,7
+101,7
@@
public:
return *this;
}
return *this;
}
- void
Notify(const uint32_t & oldValue, const uint32_t & newValue)
;
+ void
notify(const uint32_t & oldValue, const uint32_t & newValue) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-126,7
+126,7
@@
public:
return *this;
}
return *this;
}
- void
Notify(const bool & oldValue, const bool & newValue)
;
+ void
notify(const bool & oldValue, const bool & newValue) override
;
UserPtr GetUser() const { return user; }
private:
UserPtr GetUser() const { return user; }
private:
@@
-264,12
+264,12
@@
class DisconnectUser : public std::unary_function<std::pair<const uint32_t, USER
REMOTE_SCRIPT & rscript;
};
//-----------------------------------------------------------------------------
REMOTE_SCRIPT & rscript;
};
//-----------------------------------------------------------------------------
-inline void ADD_USER_NONIFIER::
N
otify(const UserPtr & user)
+inline void ADD_USER_NONIFIER::
n
otify(const UserPtr & user)
{
rs.AddUser(user);
}
//-----------------------------------------------------------------------------
{
rs.AddUser(user);
}
//-----------------------------------------------------------------------------
-inline void DEL_USER_NONIFIER::
N
otify(const UserPtr & user)
+inline void DEL_USER_NONIFIER::
n
otify(const UserPtr & user)
{
rs.DelUser(user);
}
{
rs.DelUser(user);
}
diff --git
a/projects/stargazer/plugins/other/smux/smux.h
b/projects/stargazer/plugins/other/smux/smux.h
index 808679042046ef3526007f55eb614194ca868d0d..f45beffcdfbf31f8851f79da1c110359962ab1eb 100644
(file)
--- a/
projects/stargazer/plugins/other/smux/smux.h
+++ b/
projects/stargazer/plugins/other/smux/smux.h
@@
-71,7
+71,7
@@
public:
CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER & rvalue)
: STG::PropertyNotifierBase<std::string>(),
smux(rvalue.smux), userPtr(rvalue.userPtr) {}
CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER & rvalue)
: STG::PropertyNotifierBase<std::string>(),
smux(rvalue.smux), userPtr(rvalue.userPtr) {}
- void
Notify(const std::string &, const std::string &)
;
+ void
notify(const std::string &, const std::string &) override
;
UserPtr GetUserPtr() const { return userPtr; }
UserPtr GetUserPtr() const { return userPtr; }
@@
-85,7
+85,7
@@
class ADD_DEL_TARIFF_NOTIFIER : public STG::NotifierBase<STG::TariffData> {
public:
explicit ADD_DEL_TARIFF_NOTIFIER(SMUX & s)
: STG::NotifierBase<STG::TariffData>(), smux(s) {}
public:
explicit ADD_DEL_TARIFF_NOTIFIER(SMUX & s)
: STG::NotifierBase<STG::TariffData>(), smux(s) {}
- void
Notify(const STG::TariffData &)
;
+ void
notify(const STG::TariffData &) override
;
private:
SMUX & smux;
private:
SMUX & smux;
@@
-94,7
+94,7
@@
private:
class ADD_USER_NOTIFIER : public STG::NotifierBase<UserPtr> {
public:
explicit ADD_USER_NOTIFIER(SMUX & s) : STG::NotifierBase<STG::User*>(), smux(s) {}
class ADD_USER_NOTIFIER : public STG::NotifierBase<UserPtr> {
public:
explicit ADD_USER_NOTIFIER(SMUX & s) : STG::NotifierBase<STG::User*>(), smux(s) {}
- void
Notify(const UserPtr &)
;
+ void
notify(const UserPtr &) override
;
private:
SMUX & smux;
private:
SMUX & smux;
@@
-103,7
+103,7
@@
private:
class DEL_USER_NOTIFIER : public STG::NotifierBase<UserPtr> {
public:
explicit DEL_USER_NOTIFIER(SMUX & s) : STG::NotifierBase<UserPtr>(), smux(s) {}
class DEL_USER_NOTIFIER : public STG::NotifierBase<UserPtr> {
public:
explicit DEL_USER_NOTIFIER(SMUX & s) : STG::NotifierBase<UserPtr>(), smux(s) {}
- void
Notify(const UserPtr &)
;
+ void
notify(const UserPtr &) override
;
private:
SMUX & smux;
private:
SMUX & smux;
@@
-196,26
+196,26
@@
private:
//-----------------------------------------------------------------------------
inline
//-----------------------------------------------------------------------------
inline
-void CHG_AFTER_NOTIFIER::
N
otify(const std::string &, const std::string &)
+void CHG_AFTER_NOTIFIER::
n
otify(const std::string &, const std::string &)
{
smux.UpdateTables();
}
inline
{
smux.UpdateTables();
}
inline
-void ADD_DEL_TARIFF_NOTIFIER::
N
otify(const STG::TariffData &)
+void ADD_DEL_TARIFF_NOTIFIER::
n
otify(const STG::TariffData &)
{
smux.UpdateTables();
}
inline
{
smux.UpdateTables();
}
inline
-void ADD_USER_NOTIFIER::
N
otify(const UserPtr & userPtr)
+void ADD_USER_NOTIFIER::
n
otify(const UserPtr & userPtr)
{
smux.SetNotifier(userPtr);
smux.UpdateTables();
}
inline
{
smux.SetNotifier(userPtr);
smux.UpdateTables();
}
inline
-void DEL_USER_NOTIFIER::
N
otify(const UserPtr & userPtr)
+void DEL_USER_NOTIFIER::
n
otify(const UserPtr & userPtr)
{
smux.UnsetNotifier(userPtr);
smux.UpdateTables();
{
smux.UnsetNotifier(userPtr);
smux.UpdateTables();
diff --git
a/projects/stargazer/tariffs_impl.cpp
b/projects/stargazer/tariffs_impl.cpp
index 81f582b20f1e7b0f713d94dba14d4217d2d83365..492f403f7780764383be17750ce601e54bcb8f8d 100644
(file)
--- a/
projects/stargazer/tariffs_impl.cpp
+++ b/
projects/stargazer/tariffs_impl.cpp
@@
-178,7
+178,7
@@
TariffData td;
auto ni = onDelNotifiers.begin();
while (ni != onDelNotifiers.end())
{
auto ni = onDelNotifiers.begin();
while (ni != onDelNotifiers.end())
{
- (*ni)->
N
otify(td);
+ (*ni)->
n
otify(td);
++ni;
}
++ni;
}
@@
-227,7
+227,7
@@
if (store->AddTariff(name) < 0)
auto ni = onAddNotifiers.begin();
while (ni != onAddNotifiers.end())
{
auto ni = onAddNotifiers.begin();
while (ni != onAddNotifiers.end())
{
- (*ni)->
N
otify(tariffs.back().GetTariffData());
+ (*ni)->
n
otify(tariffs.back().GetTariffData());
++ni;
}
++ni;
}
diff --git
a/projects/stargazer/traffcounter_impl.h
b/projects/stargazer/traffcounter_impl.h
index ed639f5c3ddcffb2fc1db1d669678a41a673add6..d23f63060cdc5014dd9b4b3f5964c4ea7cb024de 100644
(file)
--- a/
projects/stargazer/traffcounter_impl.h
+++ b/
projects/stargazer/traffcounter_impl.h
@@
-97,7
+97,7
@@
public:
traffCnt(rvalue.traffCnt),
user(rvalue.user)
{}
traffCnt(rvalue.traffCnt),
user(rvalue.user)
{}
- void
Notify(const uint32_t & oldValue, const uint32_t & newValue)
;
+ void
notify(const uint32_t & oldValue, const uint32_t & newValue) override
;
void SetUser(UserImpl * u) { user = u; }
UserImpl * GetUser() const { return user; }
void SetUser(UserImpl * u) { user = u; }
UserImpl * GetUser() const { return user; }
@@
-120,7
+120,7
@@
public:
traffCnt(rvalue.traffCnt),
user(rvalue.user)
{}
traffCnt(rvalue.traffCnt),
user(rvalue.user)
{}
- void
Notify(const uint32_t & oldValue, const uint32_t & newValue)
;
+ void
notify(const uint32_t & oldValue, const uint32_t & newValue) override
;
void SetUser(UserImpl * u) { user = u; }
UserImpl * GetUser() const { return user; }
private:
void SetUser(UserImpl * u) { user = u; }
UserImpl * GetUser() const { return user; }
private:
@@
-139,7
+139,7
@@
public:
traffCnt(t)
{}
virtual ~ADD_USER_NONIFIER() {}
traffCnt(t)
{}
virtual ~ADD_USER_NONIFIER() {}
- void
Notify(const UserImplPtr & user)
;
+ void
notify(const UserImplPtr & user) override
;
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
private:
ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
@@
-155,7
+155,7
@@
public:
traffCnt(t)
{}
virtual ~DEL_USER_NONIFIER() {}
traffCnt(t)
{}
virtual ~DEL_USER_NONIFIER() {}
- void
Notify(const UserImplPtr & user)
;
+ void
notify(const UserImplPtr & user) override
;
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
private:
DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
@@
-238,7
+238,7
@@
class TraffCounterImpl : public TraffCounter {
};
//-----------------------------------------------------------------------------
inline
};
//-----------------------------------------------------------------------------
inline
-void TRF_IP_BEFORE::
N
otify(const uint32_t & oldValue, const uint32_t &)
+void TRF_IP_BEFORE::
n
otify(const uint32_t & oldValue, const uint32_t &)
{
// User changes his address. Remove old IP
if (!oldValue)
{
// User changes his address. Remove old IP
if (!oldValue)
@@
-248,7
+248,7
@@
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::DelUser, oldValue);
}
//-----------------------------------------------------------------------------
inline
}
//-----------------------------------------------------------------------------
inline
-void TRF_IP_AFTER::
N
otify(const uint32_t &, const uint32_t & newValue)
+void TRF_IP_AFTER::
n
otify(const uint32_t &, const uint32_t & newValue)
{
// User changes his address. Add new IP
if (!newValue)
{
// User changes his address. Add new IP
if (!newValue)
@@
-258,13
+258,13
@@
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::AddUser, user);
}
//-----------------------------------------------------------------------------
inline
}
//-----------------------------------------------------------------------------
inline
-void ADD_USER_NONIFIER::
N
otify(const UserImplPtr & user)
+void ADD_USER_NONIFIER::
n
otify(const UserImplPtr & user)
{
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::SetUserNotifiers, user);
}
//-----------------------------------------------------------------------------
inline
{
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::SetUserNotifiers, user);
}
//-----------------------------------------------------------------------------
inline
-void DEL_USER_NONIFIER::
N
otify(const UserImplPtr & user)
+void DEL_USER_NONIFIER::
n
otify(const UserImplPtr & user)
{
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::UnSetUserNotifiers, user);
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::DelUser, user->GetCurrIP());
{
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::UnSetUserNotifiers, user);
EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::DelUser, user->GetCurrIP());
diff --git
a/projects/stargazer/user_impl.cpp
b/projects/stargazer/user_impl.cpp
index f5f4c4b4bcf4c47b8a93a90883fcd213dd00d7e7..60e801b98144c58c2fe3275cc9429a855d9f87f0 100644
(file)
--- a/
projects/stargazer/user_impl.cpp
+++ b/
projects/stargazer/user_impl.cpp
@@
-1493,7
+1493,7
@@
std::string UserImpl::GetParamValue(const std::string & name) const
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void STG::CHG_PASSIVE_NOTIFIER::
N
otify(const int & oldPassive, const int & newPassive)
+void STG::CHG_PASSIVE_NOTIFIER::
n
otify(const int & oldPassive, const int & newPassive)
{
if (newPassive && !oldPassive && user->tariff != NULL)
user->properties.cash.Set(user->cash - user->tariff->GetPassiveCost(),
{
if (newPassive && !oldPassive && user->tariff != NULL)
user->properties.cash.Set(user->cash - user->tariff->GetPassiveCost(),
@@
-1503,7
+1503,7
@@
if (newPassive && !oldPassive && user->tariff != NULL)
"Freeze");
}
//-----------------------------------------------------------------------------
"Freeze");
}
//-----------------------------------------------------------------------------
-void STG::CHG_DISABLED_NOTIFIER::
N
otify(const int & oldValue, const int & newValue)
+void STG::CHG_DISABLED_NOTIFIER::
n
otify(const int & oldValue, const int & newValue)
{
if (oldValue && !newValue && user->GetConnected())
user->Disconnect(false, "disabled");
{
if (oldValue && !newValue && user->GetConnected())
user->Disconnect(false, "disabled");
@@
-1511,7
+1511,7
@@
else if (!oldValue && newValue && user->IsInetable())
user->Connect(false);
}
//-----------------------------------------------------------------------------
user->Connect(false);
}
//-----------------------------------------------------------------------------
-void STG::CHG_TARIFF_NOTIFIER::
N
otify(const std::string &, const std::string & newTariff)
+void STG::CHG_TARIFF_NOTIFIER::
n
otify(const std::string &, const std::string & newTariff)
{
STG_LOCKER lock(&user->mutex);
if (user->settings->GetReconnectOnTariffChange() && user->connected)
{
STG_LOCKER lock(&user->mutex);
if (user->settings->GetReconnectOnTariffChange() && user->connected)
@@
-1527,13
+1527,13
@@
if (user->settings->GetReconnectOnTariffChange() &&
}
}
//-----------------------------------------------------------------------------
}
}
//-----------------------------------------------------------------------------
-void STG::CHG_CASH_NOTIFIER::
N
otify(const double & oldCash, const double & newCash)
+void STG::CHG_CASH_NOTIFIER::
n
otify(const double & oldCash, const double & newCash)
{
user->lastCashAddTime = *const_cast<time_t *>(&stgTime);
user->lastCashAdd = newCash - oldCash;
}
//-----------------------------------------------------------------------------
{
user->lastCashAddTime = *const_cast<time_t *>(&stgTime);
user->lastCashAdd = newCash - oldCash;
}
//-----------------------------------------------------------------------------
-void STG::CHG_IPS_NOTIFIER::
N
otify(const UserIPs & from, const UserIPs & to)
+void STG::CHG_IPS_NOTIFIER::
n
otify(const UserIPs & from, const UserIPs & to)
{
printfd(__FILE__, "Change IP from '%s' to '%s'\n", from.toString().c_str(), to.toString().c_str());
if (user->connected)
{
printfd(__FILE__, "Change IP from '%s' to '%s'\n", from.toString().c_str(), to.toString().c_str());
if (user->connected)
diff --git
a/projects/stargazer/user_impl.h
b/projects/stargazer/user_impl.h
index 2e254d63e767ade6fab884acf15446b3f4c4eabe..4beeb2e209247475bdc2b18a8465dae70e523460 100644
(file)
--- a/
projects/stargazer/user_impl.h
+++ b/
projects/stargazer/user_impl.h
@@
-54,7
+54,7
@@
class SettingsImpl;
class CHG_PASSIVE_NOTIFIER : public PropertyNotifierBase<int> {
public:
explicit CHG_PASSIVE_NOTIFIER(UserImpl * u) : user(u) {}
class CHG_PASSIVE_NOTIFIER : public PropertyNotifierBase<int> {
public:
explicit CHG_PASSIVE_NOTIFIER(UserImpl * u) : user(u) {}
- void
Notify(const int & oldPassive, const int & newPassive)
;
+ void
notify(const int & oldPassive, const int & newPassive) override
;
private:
UserImpl * user;
private:
UserImpl * user;
@@
-63,7
+63,7
@@
class CHG_PASSIVE_NOTIFIER : public PropertyNotifierBase<int> {
class CHG_DISABLED_NOTIFIER : public PropertyNotifierBase<int> {
public:
explicit CHG_DISABLED_NOTIFIER(UserImpl * u) : user(u) {}
class CHG_DISABLED_NOTIFIER : public PropertyNotifierBase<int> {
public:
explicit CHG_DISABLED_NOTIFIER(UserImpl * u) : user(u) {}
- void
Notify(const int & oldValue, const int & newValue)
;
+ void
notify(const int & oldValue, const int & newValue) override
;
private:
UserImpl * user;
private:
UserImpl * user;
@@
-72,7
+72,7
@@
private:
class CHG_TARIFF_NOTIFIER : public PropertyNotifierBase<std::string> {
public:
explicit CHG_TARIFF_NOTIFIER(UserImpl * u) : user(u) {}
class CHG_TARIFF_NOTIFIER : public PropertyNotifierBase<std::string> {
public:
explicit CHG_TARIFF_NOTIFIER(UserImpl * u) : user(u) {}
- void
Notify(const std::string & oldTariff, const std::string & newTariff)
;
+ void
notify(const std::string & oldTariff, const std::string & newTariff) override
;
private:
UserImpl * user;
private:
UserImpl * user;
@@
-81,7
+81,7
@@
private:
class CHG_CASH_NOTIFIER : public PropertyNotifierBase<double> {
public:
explicit CHG_CASH_NOTIFIER(UserImpl * u) : user(u) {}
class CHG_CASH_NOTIFIER : public PropertyNotifierBase<double> {
public:
explicit CHG_CASH_NOTIFIER(UserImpl * u) : user(u) {}
- void
Notify(const double & oldCash, const double & newCash)
;
+ void
notify(const double & oldCash, const double & newCash) override
;
private:
UserImpl * user;
private:
UserImpl * user;
@@
-90,7
+90,7
@@
private:
class CHG_IPS_NOTIFIER : public PropertyNotifierBase<UserIPs> {
public:
explicit CHG_IPS_NOTIFIER(UserImpl * u) : user(u) {}
class CHG_IPS_NOTIFIER : public PropertyNotifierBase<UserIPs> {
public:
explicit CHG_IPS_NOTIFIER(UserImpl * u) : user(u) {}
- void
Notify(const UserIPs & oldIPs, const UserIPs & newIPs)
;
+ void
notify(const UserIPs & oldIPs, const UserIPs & newIPs) override
;
private:
UserImpl * user;
private:
UserImpl * user;
diff --git
a/projects/stargazer/users_impl.cpp
b/projects/stargazer/users_impl.cpp
index 8cb9bee5b0e8b723d9c89a8470605e159f70d8c9..cfd692c5b02d599e2316c0a25c74480984b64f95 100644
(file)
--- a/
projects/stargazer/users_impl.cpp
+++ b/
projects/stargazer/users_impl.cpp
@@
-154,7
+154,7
@@
AddUserIntoIndexes(users.begin());
auto ni = onAddNotifiers.begin();
while (ni != onAddNotifiers.end())
{
auto ni = onAddNotifiers.begin();
while (ni != onAddNotifiers.end())
{
- (*ni)->
N
otify(&users.front());
+ (*ni)->
n
otify(&users.front());
++ni;
}
}
++ni;
}
}
@@
-164,7
+164,7
@@
AddUserIntoIndexes(users.begin());
auto ni = onAddNotifiersImpl.begin();
while (ni != onAddNotifiersImpl.end())
{
auto ni = onAddNotifiersImpl.begin();
while (ni != onAddNotifiersImpl.end())
{
- (*ni)->
N
otify(&users.front());
+ (*ni)->
n
otify(&users.front());
++ni;
}
}
++ni;
}
}
@@
-203,7
+203,7
@@
if (priv.userAddDel == 0)
auto ni = onDelNotifiers.begin();
while (ni != onDelNotifiers.end())
{
auto ni = onDelNotifiers.begin();
while (ni != onDelNotifiers.end())
{
- (*ni)->
N
otify(&(*u));
+ (*ni)->
n
otify(&(*u));
++ni;
}
}
++ni;
}
}
@@
-212,7
+212,7
@@
if (priv.userAddDel == 0)
auto ni = onDelNotifiersImpl.begin();
while (ni != onDelNotifiersImpl.end())
{
auto ni = onDelNotifiersImpl.begin();
while (ni != onDelNotifiersImpl.end())
{
- (*ni)->
N
otify(&(*u));
+ (*ni)->
n
otify(&(*u));
++ni;
}
}
++ni;
}
}
diff --git
a/tests/test_reconnect_on_tariff_change.cpp
b/tests/test_reconnect_on_tariff_change.cpp
index ca03d6c2f44be5abdcc8c394cc6d7cea51a30e86..c47bc1fdb2ee15b2cea5927650f6aec98a662fa9 100644
(file)
--- a/
tests/test_reconnect_on_tariff_change.cpp
+++ b/
tests/test_reconnect_on_tariff_change.cpp
@@
-32,7
+32,7
@@
class AfterConnectedNotifier : public STG::PropertyNotifierBase<bool>
m_disconnects(0)
{}
m_disconnects(0)
{}
- void
N
otify(const bool& oldValue, const bool& newValue) override
+ void
n
otify(const bool& oldValue, const bool& newValue) override
{
if (!oldValue && newValue)
++m_connects;
{
if (!oldValue && newValue)
++m_connects;