OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 void TCPConnection::OnReadyToSend(rtc::AsyncPacketSocket* socket) { | 485 void TCPConnection::OnReadyToSend(rtc::AsyncPacketSocket* socket) { |
486 ASSERT(socket == socket_.get()); | 486 ASSERT(socket == socket_.get()); |
487 Connection::OnReadyToSend(); | 487 Connection::OnReadyToSend(); |
488 } | 488 } |
489 | 489 |
490 void TCPConnection::CreateOutgoingTcpSocket() { | 490 void TCPConnection::CreateOutgoingTcpSocket() { |
491 ASSERT(outgoing_); | 491 ASSERT(outgoing_); |
492 // TODO(guoweis): Handle failures here (unlikely since TCP). | 492 // TODO(guoweis): Handle failures here (unlikely since TCP). |
493 int opts = (remote_candidate().protocol() == SSLTCP_PROTOCOL_NAME) | 493 int opts = (remote_candidate().protocol() == SSLTCP_PROTOCOL_NAME) |
494 ? rtc::PacketSocketFactory::OPT_SSLTCP | 494 ? rtc::PacketSocketFactory::OPT_TLS_FAKE |
495 : 0; | 495 : 0; |
496 socket_.reset(port()->socket_factory()->CreateClientTcpSocket( | 496 socket_.reset(port()->socket_factory()->CreateClientTcpSocket( |
497 rtc::SocketAddress(port()->ip(), 0), remote_candidate().address(), | 497 rtc::SocketAddress(port()->ip(), 0), remote_candidate().address(), |
498 port()->proxy(), port()->user_agent(), opts)); | 498 port()->proxy(), port()->user_agent(), opts)); |
499 if (socket_) { | 499 if (socket_) { |
500 LOG_J(LS_VERBOSE, this) | 500 LOG_J(LS_VERBOSE, this) |
501 << "Connecting from " << socket_->GetLocalAddress().ToSensitiveString() | 501 << "Connecting from " << socket_->GetLocalAddress().ToSensitiveString() |
502 << " to " << remote_candidate().address().ToSensitiveString(); | 502 << " to " << remote_candidate().address().ToSensitiveString(); |
503 set_connected(false); | 503 set_connected(false); |
504 connection_pending_ = true; | 504 connection_pending_ = true; |
505 ConnectSocketSignals(socket_.get()); | 505 ConnectSocketSignals(socket_.get()); |
506 } else { | 506 } else { |
507 LOG_J(LS_WARNING, this) << "Failed to create connection to " | 507 LOG_J(LS_WARNING, this) << "Failed to create connection to " |
508 << remote_candidate().address().ToSensitiveString(); | 508 << remote_candidate().address().ToSensitiveString(); |
509 } | 509 } |
510 } | 510 } |
511 | 511 |
512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
513 if (outgoing_) { | 513 if (outgoing_) { |
514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
515 } | 515 } |
516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
518 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 518 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
519 } | 519 } |
520 | 520 |
521 } // namespace cricket | 521 } // namespace cricket |
OLD | NEW |