Bug 1502025 - Remove failure counters from nsSocketTransport2 r=dragana
authorValentin Gosu <valentin.gosu@gmail.com>
Sun, 02 Dec 2018 23:29:10 +0000
changeset 508400 552ef6767e3b9244a8f31382306f3ffa42bdb2de
parent 508399 e18883f3328eb3d949fb7458005d84b2e2bbad3c
child 508401 389ecc0ddf76e316c9ec17e8847829f19cb49af6
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__