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

Side by Side Diff: remoting/signaling/xmpp_signal_strategy.cc

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signaling/xmpp_signal_strategy.h" 5 #include "remoting/signaling/xmpp_signal_strategy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 356
357 void XmppSignalStrategy::Core::OnSocketConnected(int result) { 357 void XmppSignalStrategy::Core::OnSocketConnected(int result) {
358 DCHECK(thread_checker_.CalledOnValidThread()); 358 DCHECK(thread_checker_.CalledOnValidThread());
359 359
360 if (result != net::OK) { 360 if (result != net::OK) {
361 OnNetworkError(result); 361 OnNetworkError(result);
362 return; 362 return;
363 } 363 }
364 364
365 writer_.reset(new BufferedSocketWriter()); 365 writer_ = BufferedSocketWriter::CreateForSocket(
366 writer_->Init(socket_.get(), base::Bind(&Core::OnNetworkError, 366 socket_.get(), base::Bind(&Core::OnNetworkError, base::Unretained(this)));
367 base::Unretained(this)));
368 367
369 XmppLoginHandler::TlsMode tls_mode; 368 XmppLoginHandler::TlsMode tls_mode;
370 if (xmpp_server_config_.use_tls) { 369 if (xmpp_server_config_.use_tls) {
371 tls_mode = (xmpp_server_config_.port == kDefaultXmppPort) 370 tls_mode = (xmpp_server_config_.port == kDefaultXmppPort)
372 ? XmppLoginHandler::TlsMode::WITH_HANDSHAKE 371 ? XmppLoginHandler::TlsMode::WITH_HANDSHAKE
373 : XmppLoginHandler::TlsMode::WITHOUT_HANDSHAKE; 372 : XmppLoginHandler::TlsMode::WITHOUT_HANDSHAKE;
374 } else { 373 } else {
375 tls_mode = XmppLoginHandler::TlsMode::NO_TLS; 374 tls_mode = XmppLoginHandler::TlsMode::NO_TLS;
376 } 375 }
377 376
(...skipping 21 matching lines...) Expand all
399 void XmppSignalStrategy::Core::OnTlsConnected(int result) { 398 void XmppSignalStrategy::Core::OnTlsConnected(int result) {
400 DCHECK(thread_checker_.CalledOnValidThread()); 399 DCHECK(thread_checker_.CalledOnValidThread());
401 DCHECK(tls_state_ == TlsState::CONNECTING); 400 DCHECK(tls_state_ == TlsState::CONNECTING);
402 tls_state_ = TlsState::CONNECTED; 401 tls_state_ = TlsState::CONNECTED;
403 402
404 if (result != net::OK) { 403 if (result != net::OK) {
405 OnNetworkError(result); 404 OnNetworkError(result);
406 return; 405 return;
407 } 406 }
408 407
409 writer_.reset(new BufferedSocketWriter()); 408 writer_ = BufferedSocketWriter::CreateForSocket(
410 writer_->Init(socket_.get(), base::Bind(&Core::OnNetworkError, 409 socket_.get(), base::Bind(&Core::OnNetworkError, base::Unretained(this)));
411 base::Unretained(this)));
412 410
413 login_handler_->OnTlsStarted(); 411 login_handler_->OnTlsStarted();
414 412
415 ReadSocket(); 413 ReadSocket();
416 } 414 }
417 415
418 void XmppSignalStrategy::Core::ReadSocket() { 416 void XmppSignalStrategy::Core::ReadSocket() {
419 DCHECK(thread_checker_.CalledOnValidThread()); 417 DCHECK(thread_checker_.CalledOnValidThread());
420 418
421 while (socket_ && !read_pending_ && (tls_state_ == TlsState::NOT_REQUESTED || 419 while (socket_ && !read_pending_ && (tls_state_ == TlsState::NOT_REQUESTED ||
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 std::string XmppSignalStrategy::GetNextId() { 525 std::string XmppSignalStrategy::GetNextId() {
528 return base::Uint64ToString(base::RandUint64()); 526 return base::Uint64ToString(base::RandUint64());
529 } 527 }
530 528
531 void XmppSignalStrategy::SetAuthInfo(const std::string& username, 529 void XmppSignalStrategy::SetAuthInfo(const std::string& username,
532 const std::string& auth_token) { 530 const std::string& auth_token) {
533 core_->SetAuthInfo(username, auth_token); 531 core_->SetAuthInfo(username, auth_token);
534 } 532 }
535 533
536 } // namespace remoting 534 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698