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: I00b06af6447d128103662a874f1b32b48b0764da
Closes-Bug: 1580715
  • Loading branch information
Nischal Sheth committed Jun 19, 2016
1 parent 1f25fb4 commit 81144e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/bgp/bgp_xmpp_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ void BgpXmppChannel::XmppPeer::Close() {
return;
}
parent_->peer_close_->Close();
XmppPeerInfoData peer_info;
peer_info.set_name(parent_->ToUVEKey());
peer_info.set_send_state("not advertising");
XMPPPeerInfo::Send(peer_info);
}

BgpXmppChannel::BgpXmppChannel(XmppChannel *channel, BgpServer *bgp_server,
Expand Down Expand Up @@ -2404,8 +2408,8 @@ BgpXmppChannel *BgpXmppChannelManager::CreateChannel(XmppChannel *channel) {

void BgpXmppChannelManager::XmppHandleChannelEvent(XmppChannel *channel,
xmps::PeerState state) {
bool created = false;
XmppChannelMap::iterator it = channel_map_.find(channel);

BgpXmppChannel *bgp_xmpp_channel = NULL;
if (state == xmps::READY) {
if (it == channel_map_.end()) {
Expand All @@ -2431,6 +2435,7 @@ void BgpXmppChannelManager::XmppHandleChannelEvent(XmppChannel *channel,
"BGP is administratively down - closing channel");
channel->Close();
}
created = true;
} else {
bgp_xmpp_channel = (*it).second;
bgp_xmpp_channel->peer_->SetDeleted(false);
Expand All @@ -2450,10 +2455,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");
XMPPPeerInfo::Send(peer_info);
}
}
Expand Down

0 comments on commit 81144e5

Please sign in to comment.