From 7ed7bb7d52827d6173ac24753bc0ed3e18d00c81 Mon Sep 17 00:00:00 2001 From: Ananth Suryanarayana Date: Thu, 28 Jul 2016 16:42:10 -0700 Subject: [PATCH] Remove periodic flap stats for XMPP Agent peers At the moment, we do not have any configuration associated with XMPP Agent peer. Hence lifetime of flap-stats cannot be cleanly managed Change-Id: I4fd9a8cbc8504bf9aed9bde073bc22af43637240 Partial-Bug: #1576437 --- src/bgp/bgp_xmpp_channel.cc | 17 ----------------- src/bgp/bgp_xmpp_channel.h | 1 - src/xmpp/xmpp_connection.cc | 5 ----- src/xmpp/xmpp_server.cc | 8 -------- src/xmpp/xmpp_server.h | 2 -- 5 files changed, 33 deletions(-) diff --git a/src/bgp/bgp_xmpp_channel.cc b/src/bgp/bgp_xmpp_channel.cc index 90cff1b4d4b..15c0e8ccfe0 100644 --- a/src/bgp/bgp_xmpp_channel.cc +++ b/src/bgp/bgp_xmpp_channel.cc @@ -2840,28 +2840,11 @@ void BgpXmppChannelManager::FillPeerInfo(const BgpXmppChannel *channel) const { PeerStatsUve::Send(peer_stats_data, "ObjectXmppPeerInfo"); } -void BgpXmppChannelManager::FillPeerStats(const XmppConnectionEndpoint *endp) - const { - if (!endp) - return; - - PeerFlapInfo flap_info; - flap_info.set_flap_count(endp->flap_count()); - flap_info.set_flap_time(endp->last_flap()); - - PeerFlapData peer_flap_data; - peer_flap_data.set_name(endp->client()); - peer_flap_data.set_flap_info(flap_info); - PeerFlap::Send(peer_flap_data, "ObjectXmppPeerInfo"); -} - bool BgpXmppChannelManager::CollectStats(BgpRouterState *state, bool first) const { CHECK_CONCURRENCY("bgp::Uve"); VisitChannels(boost::bind(&BgpXmppChannelManager::FillPeerInfo, this, _1)); - xmpp_server_->VisitEndpoints( - boost::bind(&BgpXmppChannelManager::FillPeerStats, this, _1)); bool change = false; uint32_t num_xmpp = count(); if (first || num_xmpp != state->get_num_xmpp_peer()) { diff --git a/src/bgp/bgp_xmpp_channel.h b/src/bgp/bgp_xmpp_channel.h index 8bac39e4991..1f3d692f03a 100644 --- a/src/bgp/bgp_xmpp_channel.h +++ b/src/bgp/bgp_xmpp_channel.h @@ -363,7 +363,6 @@ class BgpXmppChannelManager { friend class BgpXmppUnitTest; void FillPeerInfo(const BgpXmppChannel *channel) const; - void FillPeerStats(const XmppConnectionEndpoint *endp) const; XmppServer *xmpp_server_; BgpServer *bgp_server_; diff --git a/src/xmpp/xmpp_connection.cc b/src/xmpp/xmpp_connection.cc index 6cf47c59192..15b63786c01 100644 --- a/src/xmpp/xmpp_connection.cc +++ b/src/xmpp/xmpp_connection.cc @@ -774,11 +774,6 @@ void XmppServerConnection::increment_flap_count() { flap_info.set_flap_time(conn_endpoint->last_flap()); peer_info.set_flap_info(flap_info); XMPPPeerInfoSend(peer_info); - - PeerFlapData peer_flap_data; - peer_flap_data.set_name(ToUVEKey()); - peer_flap_data.set_flap_info(flap_info); - PeerFlap::Send(peer_flap_data, "ObjectXmppPeerInfo"); } const std::string XmppServerConnection::last_flap_at() const { diff --git a/src/xmpp/xmpp_server.cc b/src/xmpp/xmpp_server.cc index 638d958b071..9e49b24a174 100644 --- a/src/xmpp/xmpp_server.cc +++ b/src/xmpp/xmpp_server.cc @@ -537,14 +537,6 @@ void XmppServer::RemoveDeletedConnection(XmppServerConnection *connection) { ReleaseConnectionEndpoint(connection); } -void XmppServer::VisitEndpoints(VisitorFn fn) const { - tbb::mutex::scoped_lock lock(endpoint_map_mutex_); - BOOST_FOREACH(const ConnectionEndpointMap::value_type &i, - connection_endpoint_map_) { - fn(i.second); - } -} - XmppConnectionEndpoint *XmppServer::FindConnectionEndpoint( const string &endpoint_name) const { tbb::mutex::scoped_lock lock(endpoint_map_mutex_); diff --git a/src/xmpp/xmpp_server.h b/src/xmpp/xmpp_server.h index 3e47d90c803..0bc3831ece6 100644 --- a/src/xmpp/xmpp_server.h +++ b/src/xmpp/xmpp_server.h @@ -31,7 +31,6 @@ class XmppServerConnection; class XmppServer : public XmppConnectionManager { public: typedef boost::asio::ip::tcp::endpoint Endpoint; - typedef boost::function VisitorFn; XmppServer(EventManager *evm, const std::string &server_addr, const XmppChannelConfig *config); @@ -71,7 +70,6 @@ class XmppServer : public XmppConnectionManager { const std::string &ServerAddr() const { return server_addr_; } size_t ConnectionCount() const; - void VisitEndpoints(VisitorFn fn) const; XmppConnectionEndpoint *FindConnectionEndpoint( const std::string &endpoint_name) const;