From c2005aa2f31ec71fd641433193f1e55bc12839ee Mon Sep 17 00:00:00 2001 From: Tapan Karwa Date: Thu, 15 Jan 2015 15:56:45 -0800 Subject: [PATCH] Removing asserts in the channel code that were being called in response to unexpected bytes in the packet. Instead, we will return error to the SM and restart the connection. Fixes gnats bug 1049345. Change-Id: Ie7e3647b71cbc081ccb20f5033afaf61883cce45 Partial-Bug: #1408740 --- src/ifmap/client/ifmap_channel.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ifmap/client/ifmap_channel.cc b/src/ifmap/client/ifmap_channel.cc index 7d72a5afa85..1c54e360f52 100644 --- a/src/ifmap/client/ifmap_channel.cc +++ b/src/ifmap/client/ifmap_channel.cc @@ -376,7 +376,7 @@ int IFMapChannel::ExtractPubSessionId() { if ((reply_str.find("errorResult") != string::npos) || (reply_str.find("endSessionResult") != string::npos)) { - IFMAP_PEER_WARN(IFMapServerConnection, + IFMAP_PEER_WARN(IFMapServerConnection, "Error received instead of PubSessionId. Quitting.", ""); return -1; } @@ -515,7 +515,10 @@ int IFMapChannel::ReadSubscribeResponseStr() { } else if (reply_str.find(string("subscribeReceived")) != string::npos) { return 0; } else { - assert(0); + IFMAP_PEER_WARN(IFMapServerConnection, + "Unexpected message received instead of SubscribeReceived. " + "Quitting.", ""); + return -1; } return 0; } @@ -582,12 +585,16 @@ int IFMapChannel::ReadPollResponse() { // all possible responses, 3.7.5 if ((reply_str.find("errorResult") != string::npos) || (reply_str.find("endSessionResult") != string::npos)) { - IFMAP_PEER_WARN(IFMapServerConnection, + IFMAP_PEER_WARN(IFMapServerConnection, "Error received instead of PollResult. Quitting.", ""); return -1; } else if (reply_str.find(string("pollResult")) != string::npos) { size_t pos = reply_str.find(string("