Ping the premier connection on each network with higher priority.

When the selected connection becomes not receiving and there are many connections,
If we use a round-robin fashion to ping all connections, none of the connections will
be in receiving state for sufficient long time to ensure switching connections promptly.
Triggered check will help in this situation to some extent but it may still fail to switch promptly when there are a lot of connections.

With this CL, if the selected connection is weak, once we find a writable connection on a network we start to ping it with a higher priority to keep it in receiving state.
Plus, if the selected connection is weak, we choose a shorter ping interval (900ms) for all writable connections.

BUG=b/32022719

Review-Url: https://codereview.webrtc.org/2369963004
Cr-Commit-Position: refs/heads/master@{#14991}
diff --git a/webrtc/base/firewallsocketserver.cc b/webrtc/base/firewallsocketserver.cc
index d6d03df..92ac88f 100644
--- a/webrtc/base/firewallsocketserver.cc
+++ b/webrtc/base/firewallsocketserver.cc
@@ -41,13 +41,13 @@
     return SendTo(pv, cb, GetRemoteAddress());
   }
   int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override {
-    if (type_ == SOCK_DGRAM) {
-      if (!server_->Check(FP_UDP, GetLocalAddress(), addr)) {
-        LOG(LS_VERBOSE) << "FirewallSocket outbound UDP packet from "
-                        << GetLocalAddress().ToSensitiveString() << " to "
-                        << addr.ToSensitiveString() << " dropped";
-        return static_cast<int>(cb);
-      }
+    RTC_DCHECK(type_ == SOCK_DGRAM || type_ == SOCK_STREAM);
+    FirewallProtocol protocol = (type_ == SOCK_DGRAM) ? FP_UDP : FP_TCP;
+    if (!server_->Check(protocol, GetLocalAddress(), addr)) {
+      LOG(LS_VERBOSE) << "FirewallSocket outbound packet with type " << type_
+                      << " from " << GetLocalAddress().ToSensitiveString()
+                      << " to " << addr.ToSensitiveString() << " dropped";
+      return static_cast<int>(cb);
     }
     return AsyncSocketAdapter::SendTo(pv, cb, addr);
   }