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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 1277093006: Enable QUIC support in chromoting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quic_adapters
Patch Set: Created 5 years, 4 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 ba2faaad3fb54be4550060d12e4e2106bd22ab8f..1dacef1f45a0096db699fe84e366eb19a1f6e102 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -19,6 +19,7 @@
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/pseudotcp_channel_factory.h"
+#include "remoting/protocol/quic_channel_factory.h"
#include "remoting/protocol/secure_channel_factory.h"
#include "remoting/protocol/session_config.h"
#include "remoting/protocol/stream_channel_factory.h"
@@ -78,6 +79,7 @@ JingleSession::JingleSession(JingleSessionManager* session_manager)
JingleSession::~JingleSession() {
channel_multiplexer_.reset();
+ quic_channel_factory_.reset();
STLDeleteContainerPointers(pending_requests_.begin(),
pending_requests_.end());
STLDeleteContainerPointers(transport_info_requests_.begin(),
@@ -114,13 +116,16 @@ void JingleSession::StartConnection(const std::string& peer_jid,
// clients generate the same session ID concurrently.
session_id_ = base::Int64ToString(base::RandGenerator(kint64max));
+ quic_channel_factory_.reset(new QuicChannelFactory(session_id_, false));
+
// Send session-initiate message.
JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE,
session_id_);
message.initiator = session_manager_->signal_strategy_->GetLocalJid();
- message.description.reset(
- new ContentDescription(session_manager_->protocol_config_->Clone(),
- authenticator_->GetNextMessage()));
+ message.description.reset(new ContentDescription(
+ session_manager_->protocol_config_->Clone(),
+ authenticator_->GetNextMessage(),
+ quic_channel_factory_->CreateSessionInitiateConfigMessage()));
SendMessage(message);
SetState(CONNECTING);
@@ -147,6 +152,15 @@ void JingleSession::InitializeIncomingConnection(
LOG(WARNING) << "Rejecting connection from " << peer_jid_
<< " because no compatible configuration has been found.";
CloseInternal(INCOMPATIBLE_PROTOCOL);
+ return;
+ }
+
+ if (config_->is_using_quic()) {
+ quic_channel_factory_.reset(new QuicChannelFactory(session_id_, true));
+ if (!quic_channel_factory_->ProcessSessionInitiateConfigMessage(
+ initiate_message.description->quic_config_message())) {
+ CloseInternal(INCOMPATIBLE_PROTOCOL);
+ }
}
}
@@ -186,9 +200,12 @@ void JingleSession::ContinueAcceptIncomingConnection() {
if (authenticator_->state() == Authenticator::MESSAGE_READY)
auth_message = authenticator_->GetNextMessage();
+ std::string quic_config;
+ if (config_->is_using_quic())
+ quic_config = quic_channel_factory_->CreateSessionAcceptConfigMessage();
message.description.reset(
new ContentDescription(CandidateSessionConfig::CreateFrom(*config_),
- auth_message.Pass()));
+ auth_message.Pass(), quic_config));
SendMessage(message);
// Update state.
@@ -228,6 +245,11 @@ StreamChannelFactory* JingleSession::GetMultiplexedChannelFactory() {
return channel_multiplexer_.get();
}
+StreamChannelFactory* JingleSession::GetQuicChannelFactory() {
+ DCHECK(CalledOnValidThread());
+ return quic_channel_factory_.get();
+}
+
void JingleSession::Close() {
DCHECK(CalledOnValidThread());
@@ -482,6 +504,16 @@ void JingleSession::OnAccept(const JingleMessage& message,
return;
}
+ if (config_->is_using_quic()) {
+ if (!quic_channel_factory_->ProcessSessionAcceptConfigMessage(
+ message.description->quic_config_message())) {
+ CloseInternal(INCOMPATIBLE_PROTOCOL);
+ return;
+ }
+ } else {
+ quic_channel_factory_.reset();
+ }
+
SetState(CONNECTED);
DCHECK(authenticator_->state() == Authenticator::WAITING_MESSAGE);
@@ -645,6 +677,9 @@ void JingleSession::OnAuthenticated() {
new SecureChannelFactory(pseudotcp_channel_factory_.get(),
authenticator_.get()));
+ if (quic_channel_factory_)
+ quic_channel_factory_->Start(this, authenticator_->GetAuthKey());
+
SetState(AUTHENTICATED);
}
« 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