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 |