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

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

Issue 2936553003: Adding PortAllocator option to support cases where sockets can't be bound. (Closed)
Patch Set: Minor changes (comments, renaming, etc.) 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
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/basicpacketsocketfactory.cc
diff --git a/webrtc/p2p/base/basicpacketsocketfactory.cc b/webrtc/p2p/base/basicpacketsocketfactory.cc
index c478d6311202108bbaff642768508171aa1f9f06..b78a0541ce0ac8f2ea7a8318023ed7e4d824073c 100644
--- a/webrtc/p2p/base/basicpacketsocketfactory.cc
+++ b/webrtc/p2p/base/basicpacketsocketfactory.cc
@@ -114,10 +114,17 @@ 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, since this
+ // is mostly redundant in the first place. The 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.";
+ } 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.
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698