Skip to content

Commit

Permalink
Removing asserts in the channel code that were being called in respon…
Browse files Browse the repository at this point in the history
…se 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
  • Loading branch information
tkarwa committed Jan 16, 2015
1 parent a6c2c22 commit c2005aa
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/ifmap/client/ifmap_channel.cc
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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("<?xml version="));
assert(pos != string::npos);
if (pos == string::npos) {
IFMAP_PEER_WARN(IFMapServerConnection,
"Incorrectly formatted Poll response. Quitting.", "");
return -1;
}
string poll_string = reply_str.substr(pos);
increment_recv_msg_cnt();
bool success = true;
Expand All @@ -602,7 +609,9 @@ int IFMapChannel::ReadPollResponse() {
return -1;
}
} else {
assert(0);
IFMAP_PEER_WARN(IFMapServerConnection,
"Unexpected message received instead of PollResult. Quitting.", "");
return -1;
}
return 0;
}
Expand Down

0 comments on commit c2005aa

Please sign in to comment.