Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: remoting/protocol/jingle_session.cc

Issue 2911663004: [Chromoting] Drop unordered messages instead of crashing
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index dc77271e587768205feb7d08d36e69ec41fd4f12..e1d6c66a821d848a28473af828cd8e75ecc76375 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -143,10 +143,13 @@ JingleSession::OrderedMessageQueue::OnIncomingMessage(
}
// Ensure there are no duplicate sequence ids.
- DCHECK_GE(current, next_incoming_);
- DCHECK(queue_.find(current) == queue_.end());
-
- queue_.insert(std::make_pair(current, std::move(message)));
+ if (current < next_incoming_) {
+ LOG(WARNING) << "An unordered message will be dropped, expected= "
+ << next_incoming_ << " current= " << current;
+ } else {
+ DCHECK(queue_.find(current) == queue_.end());
+ queue_.insert(std::make_pair(current, std::move(message)));
+ }
auto it = queue_.begin();
while (it != queue_.end() && it->first == next_incoming_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698