Backed out changeset 798a47cd74d5 (bug 1441391) for build bustages. CLOSED TREE

This commit is contained in:
Dorel Luca 2018-03-09 14:49:02 +02:00
Родитель fd2336dfd3
Коммит 150521bb4b
3 изменённых файлов: 2 добавлений и 44 удалений

Просмотреть файл

@ -46,6 +46,7 @@ NS_IMETHODIMP
TRR::Notify(nsITimer *aTimer) TRR::Notify(nsITimer *aTimer)
{ {
if (aTimer == mTimeout) { if (aTimer == mTimeout) {
LOG(("TRR request for %s timed out\n", mHost.get()));
mTimeout = nullptr; mTimeout = nullptr;
Cancel(); Cancel();
} else { } else {

Просмотреть файл

@ -44,7 +44,6 @@ TRRService::TRRService()
, mUseGET(false) , mUseGET(false)
, mClearTRRBLStorage(false) , mClearTRRBLStorage(false)
, mConfirmationState(CONFIRM_INIT) , mConfirmationState(CONFIRM_INIT)
, mRetryConfirmInterval(1000)
{ {
MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
} }
@ -84,19 +83,13 @@ bool
TRRService::Enabled() TRRService::Enabled()
{ {
if (mConfirmationState == CONFIRM_INIT && !mWaitForCaptive) { if (mConfirmationState == CONFIRM_INIT && !mWaitForCaptive) {
LOG(("TRRService::Enabled => CONFIRM_TRYING\n"));
mConfirmationState = CONFIRM_TRYING; mConfirmationState = CONFIRM_TRYING;
} }
if (mConfirmationState == CONFIRM_TRYING) { if (mConfirmationState == CONFIRM_TRYING) {
LOG(("TRRService::Enabled MaybeConfirm()\n"));
MaybeConfirm(); MaybeConfirm();
} }
if (mConfirmationState != CONFIRM_OK) {
LOG(("TRRService::Enabled mConfirmationState=%d\n", (int)mConfirmationState));
}
return (mConfirmationState == CONFIRM_OK); return (mConfirmationState == CONFIRM_OK);
} }
@ -297,8 +290,6 @@ TRRService::MaybeConfirm()
{ {
if ((mMode == MODE_NATIVEONLY) || mConfirmer || if ((mMode == MODE_NATIVEONLY) || mConfirmer ||
mConfirmationState != CONFIRM_TRYING) { mConfirmationState != CONFIRM_TRYING) {
LOG(("TRRService:MaybeConfirm mode=%d, mConfirmer=%p mConfirmationState=%d\n",
(int)mMode, mConfirmer, (int)mConfirmationState));
return; return;
} }
nsAutoCString host; nsAutoCString host;
@ -487,24 +478,6 @@ TRRService::TRRBlacklist(const nsACString &aHost, bool privateBrowsing, bool aPa
} }
} }
NS_IMETHODIMP
TRRService::Notify(nsITimer *aTimer)
{
if (aTimer == mRetryConfirmTimer) {
mRetryConfirmTimer = nullptr;
if (mConfirmationState == CONFIRM_FAILED) {
LOG(("TRRService retry NS of %s\n", mConfirmationNS.get()));
mConfirmationState = CONFIRM_TRYING;
MaybeConfirm();
}
} else {
MOZ_CRASH("Unknown timer");
}
return NS_OK;
}
AHostResolver::LookupStatus AHostResolver::LookupStatus
TRRService::CompleteLookup(nsHostRecord *rec, nsresult status, AddrInfo *aNewRRSet, bool pb) TRRService::CompleteLookup(nsHostRecord *rec, nsresult status, AddrInfo *aNewRRSet, bool pb)
{ {
@ -523,18 +496,6 @@ TRRService::CompleteLookup(nsHostRecord *rec, nsresult status, AddrInfo *aNewRRS
LOG(("TRRService finishing confirmation test %s %d %X\n", LOG(("TRRService finishing confirmation test %s %d %X\n",
mPrivateURI.get(), (int)mConfirmationState, (unsigned int)status)); mPrivateURI.get(), (int)mConfirmationState, (unsigned int)status));
mConfirmer = nullptr; mConfirmer = nullptr;
if ((mConfirmationState == CONFIRM_FAILED) && (mMode == MODE_TRRONLY)) {
// in TRR-only mode; retry failed confirmations
NS_NewTimerWithCallback(getter_AddRefs(mRetryConfirmTimer),
this, mRetryConfirmInterval,
nsITimer::TYPE_ONE_SHOT);
if (mRetryConfirmInterval < 64000) {
// double the interval up to this point
mRetryConfirmInterval *= 2;
}
} else {
mRetryConfirmInterval = 1000;
}
return LOOKUP_OK; return LOOKUP_OK;
} }

Просмотреть файл

@ -19,14 +19,12 @@ namespace net {
class TRRService class TRRService
: public nsIObserver : public nsIObserver
, public nsITimerCallback
, public nsSupportsWeakReference , public nsSupportsWeakReference
, public AHostResolver , public AHostResolver
{ {
public: public:
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
NS_DECL_NSITIMERCALLBACK
TRRService(); TRRService();
nsresult Init(); nsresult Init();
@ -81,9 +79,7 @@ private:
CONFIRM_FAILED = 3 CONFIRM_FAILED = 3
}; };
Atomic<ConfirmationState, Relaxed> mConfirmationState; Atomic<ConfirmationState, Relaxed> mConfirmationState;
RefPtr<TRR> mConfirmer; RefPtr<TRR> mConfirmer;
nsCOMPtr<nsITimer> mRetryConfirmTimer;
uint32_t mRetryConfirmInterval; // milliseconds until retry
}; };
extern TRRService *gTRRService; extern TRRService *gTRRService;