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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 int opts = (ra->proto == PROTO_SSLTCP) | 493 int opts = (ra->proto == PROTO_SSLTCP) |
494 ? rtc::PacketSocketFactory::OPT_TLS_FAKE | 494 ? rtc::PacketSocketFactory::OPT_TLS_FAKE |
495 : 0; | 495 : 0; |
496 socket = port_->socket_factory()->CreateClientTcpSocket( | 496 socket = port_->socket_factory()->CreateClientTcpSocket( |
497 rtc::SocketAddress(port_->Network()->GetBestIP(), 0), ra->address, | 497 rtc::SocketAddress(port_->Network()->GetBestIP(), 0), ra->address, |
498 port_->proxy(), port_->user_agent(), opts); | 498 port_->proxy(), port_->user_agent(), opts); |
499 } else { | 499 } else { |
500 LOG(LS_WARNING) << "Unknown protocol (" << ra->proto << ")"; | 500 LOG(LS_WARNING) << "Unknown protocol (" << ra->proto << ")"; |
501 } | 501 } |
502 | 502 |
503 if (!socket) { | |
504 LOG(LS_WARNING) << "Socket creation failed"; | |
505 } | |
506 | |
507 // If we failed to get a socket, move on to the next protocol. | 503 // If we failed to get a socket, move on to the next protocol. |
508 if (!socket) { | 504 if (!socket) { |
| 505 LOG(LS_WARNING) << "Socket creation failed"; |
509 port()->thread()->Post(RTC_FROM_HERE, this, kMessageConnectTimeout); | 506 port()->thread()->Post(RTC_FROM_HERE, this, kMessageConnectTimeout); |
510 return; | 507 return; |
511 } | 508 } |
512 | 509 |
513 // Otherwise, create the new connection and configure any socket options. | 510 // Otherwise, create the new connection and configure any socket options. |
514 socket->SignalReadPacket.connect(this, &RelayEntry::OnReadPacket); | 511 socket->SignalReadPacket.connect(this, &RelayEntry::OnReadPacket); |
515 socket->SignalSentPacket.connect(this, &RelayEntry::OnSentPacket); | 512 socket->SignalSentPacket.connect(this, &RelayEntry::OnSentPacket); |
516 socket->SignalReadyToSend.connect(this, &RelayEntry::OnReadyToSend); | 513 socket->SignalReadyToSend.connect(this, &RelayEntry::OnReadyToSend); |
517 current_connection_ = new RelayConnection(ra, socket, port()->thread()); | 514 current_connection_ = new RelayConnection(ra, socket, port()->thread()); |
518 for (size_t i = 0; i < port_->options().size(); ++i) { | 515 for (size_t i = 0; i < port_->options().size(); ++i) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) | 829 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) |
833 entry_->ScheduleKeepAlive(); | 830 entry_->ScheduleKeepAlive(); |
834 } | 831 } |
835 | 832 |
836 void AllocateRequest::OnTimeout() { | 833 void AllocateRequest::OnTimeout() { |
837 LOG(INFO) << "Allocate request timed out"; | 834 LOG(INFO) << "Allocate request timed out"; |
838 entry_->HandleConnectFailure(connection_->socket()); | 835 entry_->HandleConnectFailure(connection_->socket()); |
839 } | 836 } |
840 | 837 |
841 } // namespace cricket | 838 } // namespace cricket |
OLD | NEW |