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

Unified Diff: webrtc/p2p/base/basicpacketsocketfactory.cc

Issue 2936553003: Adding PortAllocator option to support cases where sockets can't be bound. (Closed)
Patch Set: Comment fixes Created 3 years, 6 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
Index: webrtc/p2p/base/basicpacketsocketfactory.cc
diff --git a/webrtc/p2p/base/basicpacketsocketfactory.cc b/webrtc/p2p/base/basicpacketsocketfactory.cc
index c478d6311202108bbaff642768508171aa1f9f06..22435753cbee1be7c3b091b5f7957903591c38b4 100644
--- a/webrtc/p2p/base/basicpacketsocketfactory.cc
+++ b/webrtc/p2p/base/basicpacketsocketfactory.cc
@@ -114,10 +114,16 @@ AsyncPacketSocket* BasicPacketSocketFactory::CreateClientTcpSocket(
}
if (BindSocket(socket, local_address, 0, 0) < 0) {
- LOG(LS_ERROR) << "TCP bind failed with error "
- << socket->GetError();
- delete socket;
- return NULL;
+ // Allow BindSocket to fail if we're binding to the ANY address anyway. The
pthatcher1 2017/06/13 19:52:50 Not sure what "anyway" adds to the end of the sent
Taylor Brandstetter 2017/06/13 22:11:17 Rephrased comment.
+ // socket will be bound when we call Connect() instead.
+ if (local_address.IsAnyIP()) {
+ LOG(LS_WARNING) << "TCP bind failed with error " << socket->GetError()
+ << "; ignoring since socket is using 'any' address.";
pthatcher1 2017/06/13 19:52:49 Can you use an early return and then leave the res
Taylor Brandstetter 2017/06/13 22:11:17 I knew you would ask for an early return here. :)
+ } else {
+ LOG(LS_ERROR) << "TCP bind failed with error " << socket->GetError();
+ delete socket;
+ return NULL;
+ }
}
// If using a proxy, wrap the socket in a proxy socket.

Powered by Google App Engine
This is Rietveld 408576698