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

Unified Diff: webrtc/p2p/stunprober/stunprober.h

Issue 1162263012: Add SocketFactoryInterface::Prepare and fix how symmetric NAT is determined (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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/p2p/stunprober/stunprober.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/stunprober/stunprober.h
diff --git a/webrtc/p2p/stunprober/stunprober.h b/webrtc/p2p/stunprober/stunprober.h
index f53be3a480deed6f6b147565fb14a9ffb814aacb..30cfdb57a0cb722a5cb432c5e0a4979f68780378 100644
--- a/webrtc/p2p/stunprober/stunprober.h
+++ b/webrtc/p2p/stunprober/stunprober.h
@@ -55,7 +55,6 @@ class SocketInterface {
FAILED = -2,
};
SocketInterface() {}
- virtual int GetLocalAddress(rtc::SocketAddress* local_address) = 0;
virtual void Close() = 0;
virtual ~SocketInterface() {}
@@ -70,6 +69,8 @@ class ClientSocketInterface : public SocketInterface {
// getsockname will only return 0.0.0.0.
virtual int Connect(const rtc::SocketAddress& addr) = 0;
+ virtual int GetLocalAddress(rtc::SocketAddress* local_address) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ClientSocketInterface);
};
@@ -77,7 +78,6 @@ class ClientSocketInterface : public SocketInterface {
class ServerSocketInterface : public SocketInterface {
public:
ServerSocketInterface() {}
- virtual int Bind(const rtc::SocketAddress& addr) = 0;
virtual int SendTo(const rtc::SocketAddress& addr,
char* buf,
@@ -99,6 +99,14 @@ class ServerSocketInterface : public SocketInterface {
class SocketFactoryInterface {
public:
SocketFactoryInterface() {}
+ // To provide a chance to prepare the sockets that we need. This is
+ // implemented for chrome renderer process as the socket needs to be ready to
+ // use in browser process.
+ virtual void Prepare(size_t total_client_socket,
+ size_t total_server_socket,
+ AsyncCallback callback) {
+ callback(0);
+ }
virtual ClientSocketInterface* CreateClientSocket() = 0;
virtual ServerSocketInterface* CreateServerSocket(
size_t send_buffer_size,
@@ -134,6 +142,7 @@ class StunProber {
int num_request_sent = 0;
int num_response_received = 0;
bool behind_nat = false;
+ bool symmetric_nat = false;
int average_rtt_ms = -1;
int success_percent = 0;
int target_request_interval_ns = 0;
@@ -148,8 +157,6 @@ class StunProber {
// If the srflx_addrs has more than 1 element, the NAT is symmetric.
std::set<std::string> srflx_addrs;
-
- bool symmetric_nat() { return srflx_addrs.size() > 1; }
};
// StunProber is not thread safe. It's task_runner's responsibility to ensure
@@ -265,6 +272,12 @@ class StunProber {
return num_request_sent_ >= requests_per_ip_ * all_servers_ips_.size();
}
+ int GetTotalClientSockets() { return 1; }
+ int GetTotalServerSockets() {
+ return (shared_socket_mode_ ? 1 : all_servers_ips_.size()) *
+ requests_per_ip_;
+ }
+
bool SendNextRequest();
// Will be invoked in 1ms intervals and schedule the next request from the
« no previous file with comments | « no previous file | webrtc/p2p/stunprober/stunprober.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698