From a86a888ab355727e37790e0996b87009d6c8e16b Mon Sep 17 00:00:00 2001 From: Nipa Kumar Date: Fri, 1 Apr 2016 00:02:55 -0700 Subject: [PATCH] DiscoveryClient stops resusbcribing even after ttl period. On no response from discovery server and no error, subscribe timer is not restarted as the subscribe_cb_called_ flag was not reset. Setting the flag appropriately on every subscribe request, so subscribe timer can be restarted during the case above. Remove unnecessary curl timeout traces, use stats counters. Change-Id: I7e35ab562896a1314c1ff30de06e673fa9e90e97 Closes-Bug:1563002 --- src/discovery/client/discovery_client.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/discovery/client/discovery_client.cc b/src/discovery/client/discovery_client.cc index 2931e89113e..cd4c63da2a6 100644 --- a/src/discovery/client/discovery_client.cc +++ b/src/discovery/client/discovery_client.cc @@ -487,11 +487,13 @@ void DiscoveryServiceClient::ReEvaluatePublish(std::string serviceName, stringstream ss; impl->PrintDoc(ss); resp->publish_msg_ = ss.str(); + + DISCOVERY_CLIENT_TRACE(DiscoveryClientMsg, resp->publish_hdr_, + serviceName, resp->publish_msg_); } - /* Send publish unconditionally */ - DISCOVERY_CLIENT_TRACE(DiscoveryClientMsg, resp->publish_hdr_, - serviceName, resp->publish_msg_); + resp->pub_sent_++; + resp->publish_cb_called_ = false; SendHttpPostMessage(resp->publish_hdr_, serviceName, resp->publish_msg_); } @@ -564,6 +566,7 @@ void DiscoveryServiceClient::Publish(std::string serviceName) { DSPublishResponse *resp = loc->second; resp->pub_sent_++; + resp->publish_cb_called_ = false; SendHttpPostMessage(resp->publish_hdr_, serviceName, resp->publish_msg_); DISCOVERY_CLIENT_TRACE(DiscoveryClientMsg, resp->publish_hdr_, @@ -661,6 +664,7 @@ void DiscoveryServiceClient::Subscribe(std::string serviceName, uint8_t numbOfIn DSResponseHeader *resp = loc->second; resp->subscribe_timer_->Cancel(); resp->sub_sent_++; + resp->subscribe_cb_called_ = false; SendHttpPostMessage("subscribe", serviceName, resp->subscribe_msg_); } }