Skip to content

Commit

Permalink
DiscoveryClient stops resusbcribing even after ttl period.
Browse files Browse the repository at this point in the history
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: Ief95c50ee91c47f8d12f6390d28c8cabca8c5ffd
Closes-Bug:1563002
  • Loading branch information
nipak committed Apr 1, 2016
1 parent 4a3ad4c commit ec1df71
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/discovery/client/discovery_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ void DiscoveryServiceClient::ReEvaluatePublish(std::string serviceName,
resp->publish_msg_ = ss.str();
}

resp->pub_sent_++;
resp->publish_cb_called_ = false;
/* Send publish unconditionally */
DISCOVERY_CLIENT_TRACE(DiscoveryClientMsg, resp->publish_hdr_,
serviceName, resp->publish_msg_);
Expand Down Expand Up @@ -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_,
Expand Down Expand Up @@ -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_);
}
}
Expand Down Expand Up @@ -888,6 +892,7 @@ void DiscoveryServiceClient::SendHeartBeat(std::string serviceName,
std::string msg) {
DSPublishResponse *resp = GetPublishResponse(serviceName);
resp->pub_hb_sent_++;
resp->heartbeat_cb_called_ = false;
SendHttpPostMessage("heartbeat", serviceName, msg);
}

Expand Down

0 comments on commit ec1df71

Please sign in to comment.