[openweave-core] Disable resubscribe requests for SubscriptionClient

When weave config is reset and the tunnel goes down, subscription retry
mechanism continues to re-establish trait subscription which will fail
until the weave tunnel is established and spews logs. Disable trait
resubscribe when the subscription is terminated. It will be enabled
again when the service connectivity is established.

Bug: 80618
Test: Manually verified the subscription retry stops when weave config
      is reset and setting up the weave tunnel again starts the
      subscription properly.
      Verified that the retry works as expected if the
      network connection is lost.

Change-Id: I446cbf5b995df2a93ca9ef6e5c139e51657c0f23
diff --git a/src/adaptations/device-layer/TraitManager.cpp b/src/adaptations/device-layer/TraitManager.cpp
index d82a8fe..ceeb940 100644
--- a/src/adaptations/device-layer/TraitManager.cpp
+++ b/src/adaptations/device-layer/TraitManager.cpp
@@ -350,6 +350,7 @@
         const SubscriptionClient::InEventParam & inParam, SubscriptionClient::OutEventParam & outParam)
 {
     WEAVE_ERROR err = WEAVE_NO_ERROR;
+    TraitManager* self = reinterpret_cast<TraitManager*>(appState);
 
     switch (eventType)
     {
@@ -401,6 +402,11 @@
             event.ServiceSubscriptionStateChange.Result = kConnectivity_Lost;
             PlatformMgr().PostEvent(&event);
         }
+        // Disable resubscribe as subscription was already terminated.
+        if (!ConfigurationMgr().IsPairedToAccount()) {
+            self->mServiceSubClient->DisableResubscribe();
+            SetFlag(self->mFlags, kFlag_ServiceSubscriptionActivated, false);
+        }
         break;
 
     default: