Backed out changeset 1426ecc8209d (bug 1188435)

This commit is contained in:
Carsten "Tomcat" Book 2017-04-25 16:31:53 +02:00
Родитель 7711007990
Коммит 3f920013e0
4 изменённых файлов: 24 добавлений и 79 удалений

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

@ -2302,7 +2302,7 @@ nsHttpConnection::CheckForTraffic(bool check)
}
nsAHttpTransaction *
nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError(bool aCloseSocketTransport)
nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError()
{
MOZ_ASSERT(!mCurrentBytesRead);
@ -2314,7 +2314,7 @@ nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError(bool aCloseSocketTr
DontReuse();
mUsingSpdyVersion = 0;
if (mSpdySession) {
Unused << mSpdySession->Finish0RTT(true, true);
mSpdySession->Finish0RTT(true, true);
}
mSpdySession = nullptr;
} else {
@ -2323,7 +2323,6 @@ nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError(bool aCloseSocketTr
if (NS_SUCCEEDED(mTransaction->RestartOnFastOpenError())) {
trans = mTransaction;
}
mTransaction->SetConnection(nullptr);
}
{
@ -2332,14 +2331,6 @@ nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError(bool aCloseSocketTr
}
mTransaction = nullptr;
if (!aCloseSocketTransport) {
if (mSocketOut) {
mSocketOut->AsyncWait(nullptr, 0, 0, nullptr);
}
mSocketTransport->SetEventSink(nullptr, nullptr);
mSocketTransport->SetSecurityCallbacks(nullptr);
mSocketTransport = nullptr;
}
Close(NS_ERROR_NET_RESET);
return trans;
}

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

@ -87,7 +87,7 @@ public:
// Close this connection and return the transaction. The transaction is
// restarted as well. This will only happened before connection is
// connected.
nsAHttpTransaction * CloseConnectionFastOpenTakesTooLongOrError(bool aCloseocketTransport);
nsAHttpTransaction * CloseConnectionFastOpenTakesTooLongOrError();
// Close the underlying socket transport.
void Close(nsresult reason, bool aIsShutdown = false);

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

@ -3298,11 +3298,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Abandon()
// Tell output stream (and backup) to forget the half open socket.
if (mStreamOut) {
if (!mConnectionNegotiatingFastOpen) {
// if mConnectionNegotiatingFastOpen is active it takes care of
// mNumActiveConns bookkeeping.
gHttpHandler->ConnMgr()->RecvdConnect();
}
gHttpHandler->ConnMgr()->RecvdConnect();
mStreamOut->AsyncWait(nullptr, 0, 0, nullptr);
mStreamOut = nullptr;
}
@ -3408,12 +3404,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
// socketTransport and the rewind transaction.
mSocketTransport->SetFastOpenCallback(nullptr);
RefPtr<nsAHttpTransaction> trans =
mConnectionNegotiatingFastOpen->CloseConnectionFastOpenTakesTooLongOrError(true);
mConnectionNegotiatingFastOpen->CloseConnectionFastOpenTakesTooLongOrError();
mConnectionNegotiatingFastOpen = nullptr;
mSocketTransport = nullptr;
mStreamOut = nullptr;
mStreamIn = nullptr;
if (trans && trans->QueryHttpTransaction()) {
mTransaction = trans;
RefPtr<PendingTransactionInfo> pendingTransInfo =
@ -3496,13 +3488,7 @@ nsHalfOpenSocket::StartFastOpen(PRFileDesc *fd)
mStreamOut->AsyncWait(nullptr, 0, 0, nullptr);
mSocketTransport->SetEventSink(nullptr, nullptr);
gHttpHandler->ConnMgr()->RecvdConnect();
nsresult rv = SetupConn(mStreamOut, fd);
if (NS_FAILED(rv)) {
mStreamOut = nullptr;
mStreamIn = nullptr;
mSocketTransport = nullptr;
}
return rv;
return SetupConn(mStreamOut, fd);
}
void
@ -3510,10 +3496,15 @@ nsHttpConnectionMgr::
nsHalfOpenSocket::FastOpenConnected(nsresult aError)
{
RefPtr<nsHalfOpenSocket> deleteProtector(this);
// Check if we want to restart connection!
if ((aError == NS_ERROR_CONNECTION_REFUSED) ||
(aError == NS_ERROR_NET_TIMEOUT)) {
CancelBackupTimer();
if (NS_SUCCEEDED(aError)) {
NetAddr peeraddr;
if (NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr))) {
mEnt->RecordIPFamilyPreference(peeraddr.raw.family);
}
gHttpHandler->ResetFastOpenConsecutiveFailureCounter();
} else if ((aError == NS_ERROR_CONNECTION_REFUSED) ||
(aError == NS_ERROR_NET_TIMEOUT)) {
if (mEnt->mUseFastOpen) {
gHttpHandler->IncrementFastOpenConsecutiveFailureCounter();
mEnt->mUseFastOpen = false;
@ -3521,47 +3512,12 @@ nsHalfOpenSocket::FastOpenConnected(nsresult aError)
// This is called from nsSocketTransport::RecoverFromError. The
// socket will try connect and we need to rewind nsHttpTransaction
MOZ_ASSERT(mConnectionNegotiatingFastOpen);
RefPtr<nsAHttpTransaction> trans = mConnectionNegotiatingFastOpen->CloseConnectionFastOpenTakesTooLongOrError(false);
if (trans && trans->QueryHttpTransaction()) {
mTransaction = trans;
RefPtr<PendingTransactionInfo> pendingTransInfo =
new PendingTransactionInfo(trans->QueryHttpTransaction());
pendingTransInfo->mHalfOpen =
do_GetWeakReference(static_cast<nsISupportsWeakReference*>(this));
if (trans->Caps() & NS_HTTP_URGENT_START) {
gHttpHandler->ConnMgr()->InsertTransactionSorted(mEnt->mUrgentStartQ,
pendingTransInfo);
} else {
mEnt->InsertTransaction(pendingTransInfo);
}
}
// We are doing a restart without fast open, so the easiest way is to
// return mSocketTransport to the halfOpenSock and destroy connection.
// This makes http2 implemenntation easier.
// mConnectionNegotiatingFastOpen is going away and halfOpen is taking
// this mSocketTransport so update mNumActiveConns.
gHttpHandler->ConnMgr()->StartedConnect();
mStreamOut->AsyncWait(this, 0, 0, nullptr);
mSocketTransport->SetEventSink(this, nullptr);
mSocketTransport->SetFastOpenCallback(nullptr);
} else {
// On success or other error we proceed with connection, we just need
// to close backup timer and halfOpenSock.
CancelBackupTimer();
if (NS_SUCCEEDED(aError)) {
NetAddr peeraddr;
if (NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr))) {
mEnt->RecordIPFamilyPreference(peeraddr.raw.family);
}
gHttpHandler->ResetFastOpenConsecutiveFailureCounter();
}
mSocketTransport = nullptr;
mStreamOut = nullptr;
mStreamIn = nullptr;
Unused << mConnectionNegotiatingFastOpen->Transaction()->RestartOnFastOpenError();
}
if (mConnectionNegotiatingFastOpen) {
mSocketTransport = nullptr;
mConnectionNegotiatingFastOpen = nullptr;
}
mConnectionNegotiatingFastOpen = nullptr;
}
void
@ -3611,9 +3567,9 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutputStream *out,
}
// The nsHttpConnection object now owns these streams and sockets
mStreamOut = nullptr;
mStreamIn = nullptr;
if (!aFastOpen) {
mStreamOut = nullptr;
mStreamIn = nullptr;
mSocketTransport = nullptr;
}
conn->SetFastOpen(aFastOpen);
@ -3745,8 +3701,8 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutputStream *out,
// If this halfOpenConn was speculative, but at the ende the conn got a
// non-null transaction than this halfOpen is not speculative anymore!
if (conn->Transaction() && !conn->Transaction()->IsNullTransaction()) {
Claim();
if (conn->Transaction() && conn->Transaction()->IsNullTransaction()) {
mSpeculative = false;
}
return rv;

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

@ -2263,8 +2263,6 @@ nsHttpTransaction::RestartOnFastOpenError()
mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
mConnInfo = ci;
}
mEarlyDataDisposition = EARLY_NONE;
m0RTTInProgress = false;
return NS_OK;
}