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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 18295009: Allow transport candidates to arrive after the authentication accepted message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Factor out pending candidate handling Created 7 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') | 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 7b868c7be1b9dbf00680d40b5aae7de4aea0d61a..2aecd4c25d6856d86a4f8f0ab1645219edad48a1 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -226,6 +226,20 @@ void JingleSession::Close() {
CloseInternal(OK);
}
+void JingleSession::AddPendingRemoteCandidates(Transport* channel,
+ const std::string& name) {
+ std::list<JingleMessage::NamedCandidate>::iterator it =
+ pending_remote_candidates_.begin();
+ while(it != pending_remote_candidates_.end()) {
+ if (it->name == name) {
+ channel->AddRemoteCandidate(it->candidate);
+ it = pending_remote_candidates_.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
void JingleSession::CreateStreamChannel(
const std::string& name,
const StreamChannelCallback& callback) {
@@ -237,6 +251,7 @@ void JingleSession::CreateStreamChannel(
session_manager_->transport_factory_->CreateStreamTransport();
channel->Initialize(name, this, channel_authenticator.Pass());
channel->Connect(callback);
+ AddPendingRemoteCandidates(channel.get(), name);
channels_[name] = channel.release();
}
@@ -251,6 +266,7 @@ void JingleSession::CreateDatagramChannel(
session_manager_->transport_factory_->CreateDatagramTransport();
channel->Initialize(name, this, channel_authenticator.Pass());
channel->Connect(callback);
+ AddPendingRemoteCandidates(channel.get(), name);
channels_[name] = channel.release();
}
@@ -489,11 +505,13 @@ void JingleSession::ProcessTransportInfo(const JingleMessage& message) {
message.candidates.begin();
it != message.candidates.end(); ++it) {
ChannelsMap::iterator channel = channels_.find(it->name);
- if (channel == channels_.end()) {
- LOG(WARNING) << "Received candidate for unknown channel " << it->name;
- continue;
+ if (channel != channels_.end()) {
+ channel->second->AddRemoteCandidate(it->candidate);
+ } else {
+ // Transport info was received before the channel was created.
+ // This could happen due to messages being reordered on the wire.
+ pending_remote_candidates_.push_back(*it);
}
- channel->second->AddRemoteCandidate(it->candidate);
}
}
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698