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

Side by Side Diff: remoting/protocol/jingle_session_manager.cc

Issue 2417913002: Process incoming IQs in the same order that they were sent. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/jingle_session_manager.h" 5 #include "remoting/protocol/jingle_session_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "remoting/protocol/authenticator.h" 10 #include "remoting/protocol/authenticator.h"
11 #include "remoting/protocol/content_description.h" 11 #include "remoting/protocol/content_description.h"
12 #include "remoting/protocol/jingle_messages.h" 12 #include "remoting/protocol/jingle_messages.h"
13 #include "remoting/protocol/jingle_session.h" 13 #include "remoting/protocol/jingle_session.h"
14 #include "remoting/protocol/transport.h" 14 #include "remoting/protocol/transport.h"
15 #include "remoting/signaling/iq_sender.h" 15 #include "remoting/signaling/iq_sender.h"
16 #include "remoting/signaling/signal_strategy.h" 16 #include "remoting/signaling/signal_strategy.h"
17 #include "third_party/webrtc/base/socketaddress.h" 17 #include "third_party/webrtc/base/socketaddress.h"
18 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 18 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
19 #include "third_party/webrtc/libjingle/xmpp/constants.h"
19 20
20 using buzz::QName; 21 using buzz::QName;
21 22
22 namespace remoting { 23 namespace remoting {
23 namespace protocol { 24 namespace protocol {
24 25
25 JingleSessionManager::JingleSessionManager(SignalStrategy* signal_strategy) 26 JingleSessionManager::JingleSessionManager(SignalStrategy* signal_strategy)
26 : signal_strategy_(signal_strategy), 27 : signal_strategy_(signal_strategy),
27 protocol_config_(CandidateSessionConfig::CreateDefault()), 28 protocol_config_(CandidateSessionConfig::CreateDefault()),
28 iq_sender_(new IqSender(signal_strategy_)) { 29 iq_sender_(new IqSender(signal_strategy_)) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 return true; 127 return true;
127 } 128 }
128 129
129 SessionsMap::iterator it = sessions_.find(message->sid); 130 SessionsMap::iterator it = sessions_.find(message->sid);
130 if (it == sessions_.end()) { 131 if (it == sessions_.end()) {
131 SendReply(stanza, JingleMessageReply::INVALID_SID); 132 SendReply(stanza, JingleMessageReply::INVALID_SID);
132 return true; 133 return true;
133 } 134 }
134 135
135 it->second->OnIncomingMessage(std::move(message), base::Bind( 136 it->second->OnIncomingMessage(stanza->Attr(buzz::QN_ID), std::move(message),
136 &JingleSessionManager::SendReply, base::Unretained(this), stanza)); 137 base::Bind(&JingleSessionManager::SendReply,
138 base::Unretained(this), stanza));
137 return true; 139 return true;
138 } 140 }
139 141
140 void JingleSessionManager::SendReply(const buzz::XmlElement* original_stanza, 142 void JingleSessionManager::SendReply(const buzz::XmlElement* original_stanza,
141 JingleMessageReply::ErrorType error) { 143 JingleMessageReply::ErrorType error) {
142 signal_strategy_->SendStanza( 144 signal_strategy_->SendStanza(
143 JingleMessageReply(error).ToXml(original_stanza)); 145 JingleMessageReply(error).ToXml(original_stanza));
Sergey Ulanov 2016/10/14 18:36:54 Here original_stanza is not owned, so it may be de
kelvinp 2016/10/14 22:49:18 Good point on the point validity. A couple notes,
144 } 146 }
145 147
146 void JingleSessionManager::SessionDestroyed(JingleSession* session) { 148 void JingleSessionManager::SessionDestroyed(JingleSession* session) {
147 sessions_.erase(session->session_id_); 149 sessions_.erase(session->session_id_);
148 } 150 }
149 151
150 } // namespace protocol 152 } // namespace protocol
151 } // namespace remoting 153 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698