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

Unified Diff: webrtc/rtc_base/virtualsocketserver.h

Issue 2989303002: Make Port (and subclasses) fully "Network"-based, instead of IP-based. (Closed)
Patch Set: Add back Port constructor that takes IP for backwards compatibility. Created 3 years, 4 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/p2p/client/basicportallocator.cc ('k') | webrtc/rtc_base/virtualsocketserver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/rtc_base/virtualsocketserver.h
diff --git a/webrtc/rtc_base/virtualsocketserver.h b/webrtc/rtc_base/virtualsocketserver.h
index a08bc0ce389829f0f24fac01c3feff50c648cee2..089e73a13d09cdb9682291656fd727895c4b7d07 100644
--- a/webrtc/rtc_base/virtualsocketserver.h
+++ b/webrtc/rtc_base/virtualsocketserver.h
@@ -118,6 +118,16 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> {
delay_by_ip_[address.ipaddr()] = delay_ms;
}
+ // Used by TurnPortTest and TcpPortTest (for example), to mimic a case where
+ // a proxy returns the local host address instead of the original one the
+ // port was bound against. Please see WebRTC issue 3927 for more detail.
+ //
+ // If SetAlternativeLocalAddress(A, B) is called, then when something
+ // attempts to bind a socket to address A, it will get a socket bound to
+ // address B instead.
+ void SetAlternativeLocalAddress(const rtc::IPAddress& address,
+ const rtc::IPAddress& alternative);
+
typedef std::pair<double, double> Point;
typedef std::vector<Point> Function;
@@ -273,6 +283,7 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> {
uint32_t delay_samples_;
std::map<rtc::IPAddress, int> delay_by_ip_;
+ std::map<rtc::IPAddress, rtc::IPAddress> alternative_address_mapping_;
std::unique_ptr<Function> delay_dist_;
CriticalSection delay_crit_;
@@ -294,11 +305,6 @@ class VirtualSocket : public AsyncSocket,
SocketAddress GetLocalAddress() const override;
SocketAddress GetRemoteAddress() const override;
- // Used by TurnPortTest to mimic a case where proxy returns local host address
- // instead of the original one TurnPort was bound against. Please see WebRTC
- // issue 3927 for more detail.
- void SetAlternativeLocalAddress(const SocketAddress& addr);
-
int Bind(const SocketAddress& addr) override;
int Connect(const SocketAddress& addr) override;
int Close() override;
@@ -353,7 +359,6 @@ class VirtualSocket : public AsyncSocket,
ConnState state_;
int error_;
SocketAddress local_addr_;
- SocketAddress alternative_local_addr_;
SocketAddress remote_addr_;
// Pending sockets which can be Accepted
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | webrtc/rtc_base/virtualsocketserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698