From d6619016c144071dab0b4b32bdea6d0ede9e32d1 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 20 Aug 2016 13:15:52 +0300 Subject: [PATCH] Fix tariff name in OnConnect during reconnect on tariff change. --- projects/stargazer/user_impl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 5d505307..d7bc8ea2 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -1494,13 +1494,18 @@ else if (!oldValue && newValue && user->IsInetable()) //----------------------------------------------------------------------------- void CHG_TARIFF_NOTIFIER::Notify(const std::string &, const std::string & newTariff) { +STG_LOCKER lock(&user->mutex); if (user->settings->GetReconnectOnTariffChange() && user->connected) user->Disconnect(false, "Change tariff"); user->tariff = user->tariffs->FindByName(newTariff); if (user->settings->GetReconnectOnTariffChange() && !user->authorizedBy.empty() && user->IsInetable()) + { + // This notifier gets called *before* changing the tariff, and in Connect we want to see new tariff name. + user->property.Conf().tariffName = newTariff; user->Connect(false); + } } //----------------------------------------------------------------------------- void CHG_CASH_NOTIFIER::Notify(const double & oldCash, const double & newCash) -- 2.43.2