mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1646023 - Fix the transport status events for HTTP3 r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D90761
This commit is contained in:
parent
cba747de45
commit
7b69d6c5c8
@ -473,6 +473,10 @@ nsresult Http3Session::ProcessEvents(uint32_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
OnTransportStatus(mSocketTransport, NS_NET_STATUS_CONNECTED_TO, 0);
|
||||
// Also send the NS_NET_STATUS_TLS_HANDSHAKE_ENDED event.
|
||||
OnTransportStatus(mSocketTransport, NS_NET_STATUS_TLS_HANDSHAKE_ENDED, 0);
|
||||
|
||||
ReportHttp3Connection();
|
||||
} break;
|
||||
case Http3Event::Tag::GoawayReceived:
|
||||
@ -676,6 +680,14 @@ bool Http3Session::AddStream(nsAHttpTransaction* aHttpTransaction,
|
||||
m0RTTStreams.AppendElement(stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mFirstHttpTransaction && !IsConnected()) {
|
||||
mFirstHttpTransaction = aHttpTransaction->QueryHttpTransaction();
|
||||
LOG3(("Http3Session::AddStream first session=%p trans=%p ", this,
|
||||
mFirstHttpTransaction.get()));
|
||||
|
||||
}
|
||||
|
||||
StreamReadyToWrite(stream);
|
||||
|
||||
return true;
|
||||
@ -867,6 +879,68 @@ void Http3Session::GetSecurityCallbacks(nsIInterfaceRequestor** aOut) {
|
||||
void Http3Session::OnTransportStatus(nsITransport* aTransport, nsresult aStatus,
|
||||
int64_t aProgress) {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
|
||||
if ((aStatus == NS_NET_STATUS_CONNECTED_TO) && !IsConnected()) {
|
||||
// We should ignore the event. This is sent by the nsSocketTranpsort
|
||||
// and it does not mean that HTTP3 session is connected.
|
||||
// We will use this event to mark start of TLS handshake
|
||||
aStatus = NS_NET_STATUS_TLS_HANDSHAKE_STARTING;
|
||||
}
|
||||
|
||||
switch (aStatus) {
|
||||
// These should appear only once, deliver to the first
|
||||
// transaction on the session.
|
||||
case NS_NET_STATUS_RESOLVING_HOST:
|
||||
case NS_NET_STATUS_RESOLVED_HOST:
|
||||
case NS_NET_STATUS_CONNECTING_TO:
|
||||
case NS_NET_STATUS_CONNECTED_TO:
|
||||
case NS_NET_STATUS_TLS_HANDSHAKE_STARTING:
|
||||
case NS_NET_STATUS_TLS_HANDSHAKE_ENDED: {
|
||||
if (!mFirstHttpTransaction) {
|
||||
// if we still do not have a HttpTransaction store timings info in
|
||||
// a HttpConnection.
|
||||
// If some error occur it can happen that we do not have a connection.
|
||||
if (mConnection) {
|
||||
RefPtr<HttpConnectionBase> conn = mConnection->HttpConnection();
|
||||
conn->SetEvent(aStatus);
|
||||
}
|
||||
} else {
|
||||
mFirstHttpTransaction->OnTransportStatus(aTransport, aStatus,
|
||||
aProgress);
|
||||
}
|
||||
|
||||
if (aStatus == NS_NET_STATUS_CONNECTED_TO) {
|
||||
mFirstHttpTransaction = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// The other transport events are ignored here because there is no good
|
||||
// way to map them to the right transaction in HTTP3. Instead, the events
|
||||
// are generated again from the HTTP3 code and passed directly to the
|
||||
// correct transaction.
|
||||
|
||||
// NS_NET_STATUS_SENDING_TO:
|
||||
// This is generated by the socket transport when (part) of
|
||||
// a transaction is written out
|
||||
//
|
||||
// There is no good way to map it to the right transaction in HTTP3,
|
||||
// so it is ignored here and generated separately when the request
|
||||
// is sent from Http3Stream.
|
||||
|
||||
// NS_NET_STATUS_WAITING_FOR:
|
||||
// Created by nsHttpConnection when the request has been totally sent.
|
||||
// There is no good way to map it to the right transaction in HTTP3,
|
||||
// so it is ignored here and generated separately when the same
|
||||
// condition is complete in Http3Stream when there is no more
|
||||
// request body left to be transmitted.
|
||||
|
||||
// NS_NET_STATUS_RECEIVING_FROM
|
||||
// Generated in Http3Stream whenever the stream reads data.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Http3Session::IsDone() { return mState == CLOSED; }
|
||||
|
@ -205,6 +205,10 @@ class Http3Session final : public nsAHttpTransaction,
|
||||
uint64_t mBlockedByStreamLimitCount = 0;
|
||||
uint64_t mTransactionsBlockedByStreamLimitCount = 0;
|
||||
uint64_t mTransactionsSenderBlockedByFlowControlCount = 0;
|
||||
|
||||
// NS_NET_STATUS_CONNECTED_TO event will be created by the Http3Session.
|
||||
// We want to propagate it to the first transaction.
|
||||
RefPtr<nsHttpTransaction> mFirstHttpTransaction;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(Http3Session, NS_HTTP3SESSION_IID);
|
||||
|
@ -748,15 +748,9 @@ void HttpConnectionUDP::SetEvent(nsresult aStatus) {
|
||||
case NS_NET_STATUS_CONNECTING_TO:
|
||||
mBootstrappedTimings.connectStart = TimeStamp::Now();
|
||||
break;
|
||||
case NS_NET_STATUS_CONNECTED_TO: {
|
||||
TimeStamp tnow = TimeStamp::Now();
|
||||
mBootstrappedTimings.tcpConnectEnd = tnow;
|
||||
mBootstrappedTimings.connectEnd = tnow;
|
||||
if (!mBootstrappedTimings.secureConnectionStart.IsNull()) {
|
||||
mBootstrappedTimings.secureConnectionStart = tnow;
|
||||
}
|
||||
case NS_NET_STATUS_CONNECTED_TO:
|
||||
mBootstrappedTimings.connectEnd = TimeStamp::Now();
|
||||
break;
|
||||
}
|
||||
case NS_NET_STATUS_TLS_HANDSHAKE_STARTING:
|
||||
mBootstrappedTimings.secureConnectionStart = TimeStamp::Now();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user