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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 2967213002: Fix ASSERT in JingleMessage::OrderedMessageQueue. (Closed)
Patch Set: Reviewer's feedback Created 3 years, 5 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 | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | 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..7fdbd427b4df2eb0797bb8784b422e52cee63534 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -115,6 +115,9 @@ class JingleSession::OrderedMessageQueue {
const std::string& id,
PendingMessage&& pending_message);
+ // Sets the initial ID of the session initiate message.
+ void SetInitialId(const std::string& id);
+
private:
// Implements an ordered list by using map with the |sequence_id| as the key,
// so that |queue_| is always sorted by |sequence_id|.
@@ -162,6 +165,12 @@ JingleSession::OrderedMessageQueue::OnIncomingMessage(
return result;
};
+void JingleSession::OrderedMessageQueue::SetInitialId(const std::string& id) {
+ int current = GetSequentialId(id);
+ if (current != kInvalid)
+ next_incoming_ = current + 1;
+}
+
JingleSession::PendingMessage::PendingMessage() = default;
JingleSession::PendingMessage::PendingMessage(PendingMessage&& moved) = default;
JingleSession::PendingMessage::PendingMessage(
@@ -224,6 +233,7 @@ void JingleSession::StartConnection(
}
void JingleSession::InitializeIncomingConnection(
+ const std::string& message_id,
const JingleMessage& initiate_message,
std::unique_ptr<Authenticator> authenticator) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -234,6 +244,7 @@ void JingleSession::InitializeIncomingConnection(
peer_address_ = initiate_message.from;
authenticator_ = std::move(authenticator);
session_id_ = initiate_message.sid;
+ message_queue_->SetInitialId(message_id);
SetState(ACCEPTING);
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698