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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 570463002: Revert of Move PseudoTCP and channel auth out of LibjingleTransportFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean_dgrams
Patch Set: Created 6 years, 3 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_unittest.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 e6eb1e8a9b28da968d90ca2c9e435b9921669234..727be4b073c2845f47c03f802154a9ee34b05ec6 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -18,10 +18,7 @@
#include "remoting/protocol/content_description.h"
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/jingle_session_manager.h"
-#include "remoting/protocol/pseudotcp_channel_factory.h"
-#include "remoting/protocol/secure_channel_factory.h"
#include "remoting/protocol/session_config.h"
-#include "remoting/protocol/stream_channel_factory.h"
#include "remoting/signaling/iq_sender.h"
#include "third_party/libjingle/source/talk/p2p/base/candidate.h"
#include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
@@ -84,7 +81,7 @@
pending_requests_.end());
STLDeleteContainerPointers(transport_info_requests_.begin(),
transport_info_requests_.end());
- DCHECK(channels_.empty());
+ STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end());
session_manager_->SessionDestroyed(this);
}
@@ -190,7 +187,7 @@
SetState(CONNECTED);
if (authenticator_->state() == Authenticator::ACCEPTED) {
- OnAuthenticated();
+ SetState(AUTHENTICATED);
} else {
DCHECK_EQ(authenticator_->state(), Authenticator::WAITING_MESSAGE);
if (authenticator_->started()) {
@@ -221,17 +218,15 @@
config_is_set_ = true;
}
-StreamChannelFactory* JingleSession::GetTransportChannelFactory() {
- DCHECK(CalledOnValidThread());
- return secure_channel_factory_.get();
-}
-
-StreamChannelFactory* JingleSession::GetMultiplexedChannelFactory() {
- DCHECK(CalledOnValidThread());
- if (!channel_multiplexer_.get()) {
- channel_multiplexer_.reset(
- new ChannelMultiplexer(GetTransportChannelFactory(), kMuxChannelName));
- }
+ChannelFactory* JingleSession::GetTransportChannelFactory() {
+ DCHECK(CalledOnValidThread());
+ return this;
+}
+
+ChannelFactory* JingleSession::GetMultiplexedChannelFactory() {
+ DCHECK(CalledOnValidThread());
+ if (!channel_multiplexer_.get())
+ channel_multiplexer_.reset(new ChannelMultiplexer(this, kMuxChannelName));
return channel_multiplexer_.get();
}
@@ -259,17 +254,19 @@
const ChannelCreatedCallback& callback) {
DCHECK(!channels_[name]);
- scoped_ptr<Transport> channel =
- session_manager_->transport_factory_->CreateTransport();
- channel->Connect(name, this, callback);
+ scoped_ptr<ChannelAuthenticator> channel_authenticator =
+ authenticator_->CreateChannelAuthenticator();
+ scoped_ptr<StreamTransport> channel =
+ session_manager_->transport_factory_->CreateStreamTransport();
+ channel->Initialize(name, this, channel_authenticator.Pass());
+ channel->Connect(callback);
AddPendingRemoteCandidates(channel.get(), name);
channels_[name] = channel.release();
}
void JingleSession::CancelChannelCreation(const std::string& name) {
ChannelsMap::iterator it = channels_.find(name);
- if (it != channels_.end()) {
- DCHECK(!it->second->is_connected());
+ if (it != channels_.end() && !it->second->is_connected()) {
delete it->second;
DCHECK(!channels_[name]);
}
@@ -601,20 +598,11 @@
void JingleSession::ContinueAuthenticationStep() {
if (authenticator_->state() == Authenticator::ACCEPTED) {
- OnAuthenticated();
+ SetState(AUTHENTICATED);
} else if (authenticator_->state() == Authenticator::REJECTED) {
CloseInternal(AuthRejectionReasonToErrorCode(
authenticator_->rejection_reason()));
}
-}
-
-void JingleSession::OnAuthenticated() {
- pseudotcp_channel_factory_.reset(new PseudoTcpChannelFactory(this));
- secure_channel_factory_.reset(
- new SecureChannelFactory(pseudotcp_channel_factory_.get(),
- authenticator_.get()));
-
- SetState(AUTHENTICATED);
}
void JingleSession::CloseInternal(ErrorCode error) {
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698