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

Unified Diff: webrtc/base/firewallsocketserver.h

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 | « no previous file | webrtc/base/firewallsocketserver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/firewallsocketserver.h
diff --git a/webrtc/base/firewallsocketserver.h b/webrtc/base/firewallsocketserver.h
index 95ff039623a2800a8169cb2991f9c731958def2f..21a476b10b438205145819ce35f2884256b37f0f 100644
--- a/webrtc/base/firewallsocketserver.h
+++ b/webrtc/base/firewallsocketserver.h
@@ -58,6 +58,16 @@ class FirewallSocketServer : public SocketServer {
bool Check(FirewallProtocol p,
const SocketAddress& src, const SocketAddress& dst);
+ // Set the IP addresses for which Bind will fail. By default this list is
+ // empty. This can be used to simulate a real OS that refuses to bind to
+ // addresses under various circumstances.
+ //
+ // No matter how many addresses are added (including INADDR_ANY), the server
+ // will still allow creating outgoing TCP connections, since they don't
+ // require explicitly binding a socket.
+ void SetUnbindableIps(const std::vector<rtc::IPAddress>& unbindable_ips);
+ bool IsBindableIp(const rtc::IPAddress& ip);
+
Socket* CreateSocket(int type) override;
Socket* CreateSocket(int family, int type) override;
@@ -83,6 +93,7 @@ class FirewallSocketServer : public SocketServer {
SocketAddress dst;
};
std::vector<Rule> rules_;
+ std::vector<rtc::IPAddress> unbindable_ips_;
bool should_delete_server_;
bool udp_sockets_enabled_;
bool tcp_sockets_enabled_;
« no previous file with comments | « no previous file | webrtc/base/firewallsocketserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698