зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1369509 - Do not destroy nsHttpConnectionEntry if HalfOpenSock needs it. r=mcmanus
This commit is contained in:
Родитель
8f0fb4ecbf
Коммит
d470b7b072
|
@ -617,7 +617,9 @@ nsHttpConnectionMgr::ClearConnectionHistory()
|
|||
ent->mActiveConns.Length() == 0 &&
|
||||
ent->mHalfOpens.Length() == 0 &&
|
||||
ent->mUrgentStartQ.Length() == 0 &&
|
||||
ent->PendingQLength() == 0) {
|
||||
ent->PendingQLength() == 0 &&
|
||||
ent->mHalfOpenFastOpenBackups.Length() == 0 &&
|
||||
!ent->mDoNotDestroy) {
|
||||
iter.Remove();
|
||||
}
|
||||
}
|
||||
|
@ -2165,6 +2167,8 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, ARefBase *param)
|
|||
ent->mHalfOpens[i]->Abandon();
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(ent->mHalfOpenFastOpenBackups.Length() == 0 &&
|
||||
!ent->mDoNotDestroy);
|
||||
iter.Remove();
|
||||
}
|
||||
|
||||
|
@ -2501,6 +2505,8 @@ nsHttpConnectionMgr::OnMsgPruneDeadConnections(int32_t, ARefBase *)
|
|||
ent->mHalfOpens.Length() == 0 &&
|
||||
ent->PendingQLength() == 0 &&
|
||||
ent->mUrgentStartQ.Length() == 0 &&
|
||||
ent->mHalfOpenFastOpenBackups.Length() == 0 &&
|
||||
!ent->mDoNotDestroy &&
|
||||
(!ent->mUsingSpdy || mCT.Count() > 300)) {
|
||||
LOG((" removing empty connection entry\n"));
|
||||
iter.Remove();
|
||||
|
@ -2778,6 +2784,14 @@ nsHttpConnectionMgr::OnMsgUpdateParam(int32_t inParam, ARefBase *)
|
|||
// nsHttpConnectionMgr::nsConnectionEntry
|
||||
nsHttpConnectionMgr::nsConnectionEntry::~nsConnectionEntry()
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIdleConns.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mActiveConns.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mHalfOpens.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mUrgentStartQ.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!PendingQLength());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mHalfOpenFastOpenBackups.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDoNotDestroy);
|
||||
|
||||
MOZ_COUNT_DTOR(nsConnectionEntry);
|
||||
}
|
||||
|
||||
|
@ -3893,8 +3907,10 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Abandon()
|
|||
CancelBackupTimer();
|
||||
|
||||
// Remove the half open from the connection entry.
|
||||
if (mEnt)
|
||||
if (mEnt) {
|
||||
mEnt->mDoNotDestroy = false;
|
||||
mEnt->RemoveHalfOpen(this);
|
||||
}
|
||||
mEnt = nullptr;
|
||||
}
|
||||
|
||||
|
@ -3961,6 +3977,7 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
|
|||
this, mEnt->mConnInfo->Origin(),
|
||||
out == mStreamOut ? "primary" : "backup"));
|
||||
|
||||
mEnt->mDoNotDestroy = true;
|
||||
gHttpHandler->ConnMgr()->RecvdConnect();
|
||||
|
||||
CancelBackupTimer();
|
||||
|
@ -4013,8 +4030,11 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
|
|||
mFastOpenInProgress = false;
|
||||
mConnectionNegotiatingFastOpen = nullptr;
|
||||
}
|
||||
|
||||
return SetupConn(out, false);
|
||||
nsresult rv = SetupConn(out, false);
|
||||
if (mEnt) {
|
||||
mEnt->mDoNotDestroy = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -4090,8 +4110,10 @@ nsHalfOpenSocket::StartFastOpen()
|
|||
mStreamIn = nullptr;
|
||||
mSocketTransport = nullptr;
|
||||
mFastOpenInProgress = false;
|
||||
Abandon();
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
mEnt->mDoNotDestroy = true;
|
||||
MOZ_ASSERT(gHttpHandler->ConnMgr()->mNumHalfOpenConns);
|
||||
if (gHttpHandler->ConnMgr()->mNumHalfOpenConns) { // just in case
|
||||
gHttpHandler->ConnMgr()->mNumHalfOpenConns--;
|
||||
|
@ -4139,6 +4161,7 @@ nsHalfOpenSocket::StartFastOpen()
|
|||
SetupBackupTimer();
|
||||
}
|
||||
}
|
||||
mEnt->mDoNotDestroy = false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -4168,6 +4191,8 @@ nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
|
|||
|
||||
RefPtr<nsHalfOpenSocket> deleteProtector(this);
|
||||
|
||||
mEnt->mDoNotDestroy = true;
|
||||
|
||||
// Delete 2 points of entry to FastOpen function so that we do not reenter.
|
||||
mEnt->mHalfOpenFastOpenBackups.RemoveElement(this);
|
||||
mSocketTransport->SetFastOpenCallback(nullptr);
|
||||
|
@ -4241,6 +4266,7 @@ nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
|
|||
|
||||
mFastOpenInProgress = false;
|
||||
mConnectionNegotiatingFastOpen = nullptr;
|
||||
mEnt->mDoNotDestroy = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4698,6 +4724,7 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
|
|||
, mPreferIPv4(false)
|
||||
, mPreferIPv6(false)
|
||||
, mUsedForConnection(false)
|
||||
, mDoNotDestroy(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsConnectionEntry);
|
||||
mUseFastOpen = gHttpHandler->UseFastOpen();
|
||||
|
|
|
@ -302,6 +302,8 @@ private:
|
|||
// Try using TCP Fast Open.
|
||||
bool mUseFastOpen : 1;
|
||||
|
||||
bool mDoNotDestroy : 1;
|
||||
|
||||
// Set the IP family preference flags according the connected family
|
||||
void RecordIPFamilyPreference(uint16_t family);
|
||||
// Resets all flags to their default values
|
||||
|
@ -413,7 +415,7 @@ private:
|
|||
already_AddRefed<PendingTransactionInfo>
|
||||
FindTransactionHelper(bool removeWhenFound);
|
||||
|
||||
nsConnectionEntry *mEnt;
|
||||
nsConnectionEntry *mEnt;
|
||||
RefPtr<nsAHttpTransaction> mTransaction;
|
||||
bool mDispatchedMTransaction;
|
||||
nsCOMPtr<nsISocketTransport> mSocketTransport;
|
||||
|
|
Загрузка…
Ссылка в новой задаче