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

Side by Side Diff: p2p/base/relayport.cc

Issue 3015543002: Try creating sockets again if network change occurs after bind failed. (Closed)
Patch Set: Split up TestGatherLowCostNetworkOnly Created 3 years, 2 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 | « no previous file | p2p/client/basicportallocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | p2p/client/basicportallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698