Chromium Code Reviews| Index: remoting/protocol/jingle_session.cc |
| diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
| index 7b868c7be1b9dbf00680d40b5aae7de4aea0d61a..27381c9f0f4bacc38cd3e8378aeb33ee6791a832 100644 |
| --- a/remoting/protocol/jingle_session.cc |
| +++ b/remoting/protocol/jingle_session.cc |
| @@ -237,6 +237,17 @@ void JingleSession::CreateStreamChannel( |
| session_manager_->transport_factory_->CreateStreamTransport(); |
| channel->Initialize(name, this, channel_authenticator.Pass()); |
| channel->Connect(callback); |
| + // Check if any remote candidates were already received for this channel. |
|
Wez
2013/07/12 22:43:24
nit: Blank line before this comment.
rmsousa
2013/07/13 00:11:47
Moved to the header for the new function.
|
| + std::list<JingleMessage::NamedCandidate>::iterator it = |
|
Wez
2013/07/12 22:43:24
nit: This code fragment is identical to the one in
rmsousa
2013/07/13 00:11:47
Done.
|
| + 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; |
| + } |
| + } |
| channels_[name] = channel.release(); |
| } |
| @@ -251,6 +262,17 @@ void JingleSession::CreateDatagramChannel( |
| session_manager_->transport_factory_->CreateDatagramTransport(); |
| channel->Initialize(name, this, channel_authenticator.Pass()); |
| channel->Connect(callback); |
|
Wez
2013/07/12 22:43:24
nit: Blank line before this comment.
rmsousa
2013/07/13 00:11:47
Moved to the header for the new function.
|
| + // Check if any remote candidates were already received for this channel. |
| + 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; |
| + } |
| + } |
| channels_[name] = channel.release(); |
| } |
| @@ -489,11 +511,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); |
| } |
| } |