Bug 1502025 - Remove failure counters from nsSocketTransport2 r=dragana
☠☠ backed out by d20e7d5440cb ☠ ☠
authorValentin Gosu <valentin.gosu@gmail.com>
Fri, 30 Nov 2018 17:25:19 +0000
changeset 508226 9bfdb64bf81e6e92999272c91f5d51c6847fb53a
parent 508225 99eed75874f1fa653c3cc35a509b191d16ec89fe
child 508227 731cbca9930db52362a0a6c2c76d43597afe36b4
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1502025
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1502025 - Remove failure counters from nsSocketTransport2 r=dragana Differential Revision: https://phabricator.services.mozilla.com/D13333
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsSocketTransport2.h
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -680,25 +680,16 @@ nsSocketOutputStream::AsyncWait(nsIOutpu
   mTransport->OnOutputPending();
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // socket transport impl
 //-----------------------------------------------------------------------------
 
-// We assume we have connectivity at first.
-bool nsSocketTransport::sHasIPv4Connectivity = true;
-bool nsSocketTransport::sHasIPv6Connectivity = true;
-
-uint32_t nsSocketTransport::sIPv4FailedCounter = 0;
-uint32_t nsSocketTransport::sIPv6FailedCounter = 0;
-
-const uint32_t kFailureThreshold = 50;
-
 nsSocketTransport::nsSocketTransport()
     : mTypes(nullptr),
       mTypeCount(0),
       mPort(0),
       mProxyPort(0),
       mOriginPort(0),
       mProxyTransparent(false),
       mProxyTransparentResolvesHost(false),
@@ -1761,29 +1752,21 @@ bool nsSocketTransport::RecoverFromError
 
   } else {
     // This is only needed for telemetry.
     if (NS_SUCCEEDED(mFirstRetryError)) {
       mFirstRetryError = mCondition;
     }
     if ((mState == STATE_CONNECTING) && mDNSRecord) {
       if (mNetAddr.raw.family == AF_INET) {
-        sIPv4FailedCounter++;
-        if (sIPv4FailedCounter > kFailureThreshold) {
-          sHasIPv4Connectivity = false;
-        }
         if (mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
           Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
                                 UNSUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS);
         }
       } else if (mNetAddr.raw.family == AF_INET6) {
-        sIPv6FailedCounter++;
-        if (sIPv6FailedCounter > kFailureThreshold) {
-          sHasIPv6Connectivity = false;
-        }
         if (mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
           Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
                                 UNSUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS);
         }
       }
     }
 
     if (mConnectionFlags & RETRY_WITH_DIFFERENT_IP_FAMILY &&
@@ -2236,25 +2219,21 @@ void nsSocketTransport::OnSocketReady(PR
 
     if (status == PR_SUCCESS) {
       //
       // we are connected!
       //
       OnSocketConnected();
 
       if (mNetAddr.raw.family == AF_INET) {
-        sIPv4FailedCounter = 0;
-        sHasIPv4Connectivity = true;
         if (mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
           Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
                                 SUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS);
         }
       } else if (mNetAddr.raw.family == AF_INET6) {
-        sIPv6FailedCounter = 0;
-        sHasIPv6Connectivity = true;
         if (mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
           Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
                                 SUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS);
         }
       }
     } else {
       PRErrorCode code = PR_GetError();
 #if defined(TEST_CONNECT_ERRORS)
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -166,19 +166,16 @@ class nsSocketTransport final : public n
   uint64_t ByteCountSent() override { return mOutput.ByteCount(); }
   static void CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled);
   static void SendPRBlockingTelemetry(
       PRIntervalTime aStart, Telemetry::HistogramID aIDNormal,
       Telemetry::HistogramID aIDShutdown,
       Telemetry::HistogramID aIDConnectivityChange,
       Telemetry::HistogramID aIDLinkChange, Telemetry::HistogramID aIDOffline);
 
-  static bool HasIPv4Connectivity() { return sHasIPv4Connectivity; }
-  static bool HasIPv6Connectivity() { return sHasIPv6Connectivity; }
-
  protected:
   virtual ~nsSocketTransport();
   void CleanupTypes();
 
  private:
   // event types
   enum {
     MSG_ENSURE_CONNECT,
@@ -466,19 +463,14 @@ class nsSocketTransport final : public n
 
   // A Fast Open callback.
   TCPFastOpen *mFastOpenCallback;
   bool mFastOpenLayerHasBufferedData;
   uint8_t mFastOpenStatus;
   nsresult mFirstRetryError;
 
   bool mDoNotRetryToConnect;
-
-  static bool sHasIPv4Connectivity;
-  static bool sHasIPv6Connectivity;
-  static uint32_t sIPv4FailedCounter;
-  static uint32_t sIPv6FailedCounter;
 };
 
 }  // namespace net
 }  // namespace mozilla
 
 #endif  // !nsSocketTransport_h__