Skip to content

Commit

Permalink
Fix issues in updating XmppPeer send state
Browse files Browse the repository at this point in the history
Following changes are implemented:

- Set as "in sync" when channel comes up
- Set as "not advertising" when peer close starts

Change-Id: I5ed20835b01429e56598ff2c1c78196e56f7bb05
Closes-Bug: 1580715
  • Loading branch information
Nischal Sheth committed Jun 19, 2016
1 parent 441bedd commit 0bb1d8e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/bgp/bgp_xmpp_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,13 @@ void BgpXmppChannel::XmppPeer::Close(bool non_graceful) {
XmppConnection *connection =
const_cast<XmppConnection *>(parent_->channel_->connection());

if (connection && !connection->IsActiveChannel())
if (connection && !connection->IsActiveChannel()) {
parent_->peer_close_->Close(false);
XmppPeerInfoData peer_info;
peer_info.set_name(parent_->ToUVEKey());
peer_info.set_send_state("not advertising");
parent_->XMPPPeerInfoSend(peer_info);
}
}

BgpXmppChannel::BgpXmppChannel(XmppChannel *channel, BgpServer *bgp_server,
Expand Down Expand Up @@ -2729,6 +2734,7 @@ void BgpXmppChannelManager::XmppHandleChannelEvent(XmppChannel *channel,
xmps::PeerState state) {
tbb::mutex::scoped_lock lock(mutex_);

bool created = false;
XmppChannelMap::iterator it = channel_map_.find(channel);
BgpXmppChannel *bgp_xmpp_channel = NULL;
if (state == xmps::READY) {
Expand All @@ -2755,6 +2761,7 @@ void BgpXmppChannelManager::XmppHandleChannelEvent(XmppChannel *channel,
"BGP is administratively down - closing channel");
channel->Close();
}
created = true;
} else {
bgp_xmpp_channel = (*it).second;
if (bgp_xmpp_channel->peer_deleted())
Expand All @@ -2776,10 +2783,10 @@ void BgpXmppChannelManager::XmppHandleChannelEvent(XmppChannel *channel,
"Peer not found on channel not ready event");
}
}
if (bgp_xmpp_channel) {
if (created) {
XmppPeerInfoData peer_info;
peer_info.set_name(bgp_xmpp_channel->Peer()->ToUVEKey());
peer_info.set_send_state("not advertising");
peer_info.set_send_state("in sync");
bgp_xmpp_channel->XMPPPeerInfoSend(peer_info);
}
}
Expand Down

0 comments on commit 0bb1d8e

Please sign in to comment.