]> git.stg.codes - stg.git/commitdiff
Merge branch 'stg-2.409'
authorMaxim Mamontov <faust.madf@gmail.com>
Sat, 20 Aug 2016 10:25:24 +0000 (13:25 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Sat, 20 Aug 2016 10:25:24 +0000 (13:25 +0300)
projects/stargazer/user_impl.cpp

index 11f4385b505a853f2bb75a4f34dd62679b4a95a3..fe197cc5f9bec5c29d4d175ba21f08856b51e7d8 100644 (file)
@@ -1563,13 +1563,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)