From 9689b0b2ee6fc669a6c03809a0416ddc3d236842 Mon Sep 17 00:00:00 2001 From: Sundaresan Rajangam Date: Wed, 27 Jan 2016 15:29:31 -0800 Subject: [PATCH] Fix inconsistency in sandesh c++/python client code in collector service subscription with discovery c++ sandesh client: - subscribes for collector service irrespective of whether the collector list is provided in the InitGenerator(), if CollectorSubFn is not NULL. python sandesh client: - subscribes for collector service only if the collector list is empty in init_generator() Modified the sandesh c++ library to subscribe for the collector service only if the collector list is empty. Change-Id: I57a2c8f2612df0b8b8f4ebef72d2dd7f62d8f626 Closes-Bug: #1531524 --- library/cpp/sandesh_client.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/cpp/sandesh_client.cc b/library/cpp/sandesh_client.cc index aadaa947..5e00cf64 100644 --- a/library/cpp/sandesh_client.cc +++ b/library/cpp/sandesh_client.cc @@ -102,7 +102,9 @@ void SandeshClient::Initiate() { sm_->SetAdminState(false); if (primary_ != Endpoint()) sm_->SetCandidates(primary_,secondary_); - if (csf_!=0){ + // subscribe for the collector service only if the collector list + // is not provided by the generator. + else if (csf_ != 0) { SANDESH_LOG(INFO, "Subscribe to Discovery Service for Collector" ); csf_(g_vns_constants.COLLECTOR_DISCOVERY_SERVICE_NAME, 2, boost::bind(&SandeshClient::CollectorHandler, this, _1));