Skip to content

Commit

Permalink
Merge "Enqueued WriteReadyCb results in accessing a deleted AgentDnsX…
Browse files Browse the repository at this point in the history
…mppChannel object. We need to UnRegisterWriteReady when the object is deleted." into R2.20
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 8, 2016
2 parents 29df647 + b601c88 commit e8c67de
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/bgp/test/bgp_xmpp_channel_test.cc
Expand Up @@ -51,6 +51,7 @@ class XmppChannelMock : public XmppChannel {
}
MOCK_METHOD2(RegisterReceive, void(xmps::PeerId, ReceiveCb));
MOCK_METHOD1(UnRegisterReceive, void(xmps::PeerId));
MOCK_METHOD1(UnRegisterWriteReady, void(xmps::PeerId));
std::string ToString() const { return string("fake"); }
std::string StateName() const { return string("Established"); }

Expand Down
1 change: 1 addition & 0 deletions src/bgp/test/bgp_xmpp_parse_test.cc
Expand Up @@ -32,6 +32,7 @@ class XmppChannelMock : public XmppChannel {
}
void RegisterReceive(xmps::PeerId id, ReceiveCb callback) { }
void UnRegisterReceive(xmps::PeerId id) { }
void UnRegisterWriteReady(xmps::PeerId id) { }
string ToString() const { return string("fake"); }
string StateName() const { return string("Established"); }

Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/controller/controller_dns.cc
Expand Up @@ -30,6 +30,7 @@ AgentDnsXmppChannel::AgentDnsXmppChannel(Agent *agent,
AgentDnsXmppChannel::~AgentDnsXmppChannel() {
if (channel_) {
channel_->UnRegisterReceive(xmps::DNS);
channel_->UnRegisterWriteReady(xmps::DNS);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/controller/controller_ifmap.cc
Expand Up @@ -36,6 +36,7 @@ AgentIfMapXmppChannel::AgentIfMapXmppChannel(Agent *agent, XmppChannel *channel,

AgentIfMapXmppChannel::~AgentIfMapXmppChannel() {
channel_->UnRegisterReceive(xmps::CONFIG);
channel_->UnRegisterWriteReady(xmps::CONFIG);
}

uint64_t AgentIfMapXmppChannel::NewSeqNumber() {
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/controller/controller_peer.cc
Expand Up @@ -84,6 +84,7 @@ AgentXmppChannel::~AgentXmppChannel() {
BgpPeer *bgp_peer = bgp_peer_id_.get();
assert(bgp_peer == NULL);
channel_->UnRegisterReceive(xmps::BGP);
channel_->UnRegisterWriteReady(xmps::BGP);
}

void AgentXmppChannel::RegisterXmppChannel(XmppChannel *channel) {
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/test/test_cmn_util.h
Expand Up @@ -394,6 +394,7 @@ class XmppChannelMock : public XmppChannel {
void Close() { }
MOCK_METHOD2(RegisterReceive, void(xmps::PeerId, ReceiveCb));
MOCK_METHOD1(UnRegisterReceive, void(xmps::PeerId));
MOCK_METHOD1(UnRegisterWriteReady, void(xmps::PeerId));
std::string ToString() const { return string("fake"); }
std::string StateName() const { return string("Established"); }

Expand Down
2 changes: 1 addition & 1 deletion src/xmpp/test/SConscript
Expand Up @@ -80,7 +80,6 @@ env.Alias('controller/xmpp:xmpp_stream_message_server_test', xmpp_stream_message

test_suite = [
xmpp_client_sm_test,
xmpp_pubsub_test,
xmpp_regex_test,
xmpp_server_sm_test,
xmpp_server_test,
Expand All @@ -90,6 +89,7 @@ test_suite = [
]

flaky_test_suite = [
xmpp_pubsub_test,
xmpp_stream_message_client_test,
xmpp_stream_message_server_test,
]
Expand Down
1 change: 1 addition & 0 deletions src/xmpp/xmpp_channel.h
Expand Up @@ -48,6 +48,7 @@ class XmppChannel {
virtual void RegisterReceive(xmps::PeerId, ReceiveCb) = 0;
virtual void UnRegisterReceive(xmps::PeerId) = 0;
virtual void RegisterRxMessageTraceCallback(RxMessageTraceCb cb) = 0;
virtual void UnRegisterWriteReady(xmps::PeerId id) = 0;
virtual void Close() = 0;
virtual std::string ToString() const = 0;
virtual std::string StateName() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/xmpp/xmpp_channel_mux.h
Expand Up @@ -47,6 +47,7 @@ class XmppChannelMux : public XmppChannel {

virtual void ProcessXmppMessage(const XmppStanza::XmppMessage *msg);
void WriteReady(const boost::system::error_code &ec);
virtual void UnRegisterWriteReady(xmps::PeerId id);

void HandleStateEvent(xmsm::XmState state);

Expand All @@ -61,7 +62,6 @@ class XmppChannelMux : public XmppChannel {

private:
void RegisterWriteReady(xmps::PeerId, SendReadyCb);
void UnRegisterWriteReady(xmps::PeerId id);

typedef std::map<xmps::PeerId, SendReadyCb> WriteReadyCbMap;
typedef std::map<xmps::PeerId, ReceiveCb> ReceiveCbMap;
Expand Down

0 comments on commit e8c67de

Please sign in to comment.