Skip to content

Commit

Permalink
Merge "DiscoveryClient stops resusbcribing even after ttl period." in…
Browse files Browse the repository at this point in the history
…to R2.21.x
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 1, 2016
2 parents 0b288c0 + 5450c6a commit cab05c0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/discovery/client/discovery_client.cc
Expand Up @@ -486,6 +486,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 @@ -666,6 +668,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 @@ -894,6 +897,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 Expand Up @@ -930,11 +934,6 @@ void DiscoveryServiceClient::HeartBeatResponseHandler(std::string &xmls,

// Errorcode is of type CURLcode
if (ec.value() != 0) {
DISCOVERY_CLIENT_TRACE(DiscoveryClientErrorMsg,
"Error HeartBeatResponseHandler ",
serviceName + " " + curl_error_category.message(ec.value()),
ec.value());

resp->pub_hb_fail_++;
// Resend original publish request after exponential back-off
resp->attempts_++;
Expand All @@ -951,6 +950,11 @@ void DiscoveryServiceClient::HeartBeatResponseHandler(std::string &xmls,
// reset attempts so publish can be sent right away
resp->attempts_ = 0;
}
} else {
DISCOVERY_CLIENT_TRACE(DiscoveryClientErrorMsg,
"Error HeartBeatResponseHandler ",
serviceName + " " + curl_error_category.message(ec.value()),
ec.value());
}

// Update connection info
Expand Down

0 comments on commit cab05c0

Please sign in to comment.