| Index: remoting/protocol/jingle_session.cc
|
| ===================================================================
|
| --- remoting/protocol/jingle_session.cc (revision 212457)
|
| +++ remoting/protocol/jingle_session.cc (working copy)
|
| @@ -226,6 +226,20 @@
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| 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);
|
| }
|
| }
|
|
|
|
|