mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1808945 - Make sure we call CreateWebTransport after negotiation is done, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D169217
This commit is contained in:
parent
e03df92cad
commit
3c4bc0cf32
@ -941,6 +941,7 @@ bool Http3Session::AddStream(nsAHttpTransaction* aHttpTransaction,
|
||||
LOG3(("Http3Session::AddStream new WeTransport session %p atrans=%p.\n",
|
||||
this, aHttpTransaction));
|
||||
stream = new Http3WebTransportSession(aHttpTransaction, this);
|
||||
mHasWebTransportSession = true;
|
||||
} else {
|
||||
LOG3(("Http3Session::AddStream %p atrans=%p.\n", this, aHttpTransaction));
|
||||
stream = new Http3Stream(aHttpTransaction, this, cos,
|
||||
@ -956,6 +957,12 @@ bool Http3Session::AddStream(nsAHttpTransaction* aHttpTransaction,
|
||||
if (!mCannotDo0RTTStreams.Contains(stream)) {
|
||||
mCannotDo0RTTStreams.AppendElement(stream);
|
||||
}
|
||||
if ((mWebTransportNegotiationStatus ==
|
||||
WebTransportNegotiation::NEGOTIATING) &&
|
||||
(trans && trans->IsForWebTransport())) {
|
||||
LOG(("waiting for negotiation"));
|
||||
mWaitingForWebTransportNegotiation.AppendElement(stream);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
m0RTTStreams.AppendElement(stream);
|
||||
@ -964,6 +971,7 @@ bool Http3Session::AddStream(nsAHttpTransaction* aHttpTransaction,
|
||||
if ((mWebTransportNegotiationStatus ==
|
||||
WebTransportNegotiation::NEGOTIATING) &&
|
||||
(trans && trans->IsForWebTransport())) {
|
||||
LOG(("waiting for negotiation"));
|
||||
mWaitingForWebTransportNegotiation.AppendElement(stream);
|
||||
return true;
|
||||
}
|
||||
@ -982,7 +990,7 @@ bool Http3Session::CanReuse() {
|
||||
// TODO: we assume "pooling" is disabled here, so we don't allow this session
|
||||
// to be reused. "pooling" will be implemented in bug 1815735.
|
||||
return CanSandData() && !(mGoawayReceived || mShouldClose) &&
|
||||
!mConnInfo->GetWebTransport();
|
||||
!mHasWebTransportSession;
|
||||
}
|
||||
|
||||
void Http3Session::QueueStream(Http3StreamBase* stream) {
|
||||
@ -1068,6 +1076,15 @@ nsresult Http3Session::TryActivating(
|
||||
} else {
|
||||
MOZ_RELEASE_ASSERT(aStream->GetHttp3WebTransportSession(),
|
||||
"It must be a WebTransport session");
|
||||
// Don't call CreateWebTransport if we are still waiting for the negotiation
|
||||
// result.
|
||||
if (mWebTransportNegotiationStatus ==
|
||||
WebTransportNegotiation::NEGOTIATING) {
|
||||
if (!mWaitingForWebTransportNegotiation.Contains(aStream)) {
|
||||
mWaitingForWebTransportNegotiation.AppendElement(aStream);
|
||||
}
|
||||
return NS_BASE_STREAM_WOULD_BLOCK;
|
||||
}
|
||||
rv = mHttp3Connection->CreateWebTransport(aAuthorityHeader, aPath, aHeaders,
|
||||
aStreamId);
|
||||
}
|
||||
|
@ -344,6 +344,8 @@ class Http3Session final : public nsAHttpTransaction, public nsAHttpConnection {
|
||||
|
||||
nsTArray<RefPtr<Http3StreamBase>> mWebTransportSessions;
|
||||
nsTArray<RefPtr<Http3StreamBase>> mWebTransportStreams;
|
||||
|
||||
bool mHasWebTransportSession = false;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(Http3Session, NS_HTTP3SESSION_IID);
|
||||
|
@ -350,6 +350,7 @@ nsresult Http3WebTransportStream::ReadSegments() {
|
||||
rv = NS_OK;
|
||||
break;
|
||||
}
|
||||
mSendState = SENDING;
|
||||
rv = mSendStreamPipeIn->ReadSegments(ReadRequestSegment, this,
|
||||
nsIOService::gDefaultSegmentSize,
|
||||
&sendBytes);
|
||||
|
@ -135,7 +135,7 @@ impl Http3TestServer {
|
||||
for (expires, sessions) in self.sessions_to_close.iter_mut() {
|
||||
if *expires <= now {
|
||||
for s in sessions.iter_mut() {
|
||||
s.close_session(0, "").unwrap();
|
||||
mem::drop(s.close_session(0, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ add_task(async function test_wt_stream_send_and_stats() {
|
||||
let stream = await streamCreatePromise(webTransport, false);
|
||||
let outputStream = stream.outputStream;
|
||||
|
||||
let data = "123456";
|
||||
let data = "1234567890ABC";
|
||||
outputStream.write(data, data.length);
|
||||
|
||||
// We need some time to send the packet out.
|
||||
|
Loading…
Reference in New Issue
Block a user