Bug 1953331 - Generate WebTransport ID in a static function, r=jesup,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D241288
This commit is contained in:
@@ -7005,7 +7005,7 @@ nsresult nsHttpChannel::BeginConnect() {
|
|||||||
wtconSettings->GetDedicated(&dedicated);
|
wtconSettings->GetDedicated(&dedicated);
|
||||||
if (dedicated) {
|
if (dedicated) {
|
||||||
connInfo->SetWebTransportId(
|
connInfo->SetWebTransportId(
|
||||||
gHttpHandler->ConnMgr()->GenerateNewWebTransportId());
|
nsHttpConnectionInfo::GenerateNewWebTransportId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
connInfo = new nsHttpConnectionInfo(host, port, ""_ns, mUsername,
|
connInfo = new nsHttpConnectionInfo(host, port, ""_ns, mUsername,
|
||||||
|
|||||||
@@ -72,6 +72,15 @@ nsHttpConnectionInfo::nsHttpConnectionInfo(
|
|||||||
true, aIsHttp3, aWebTransport);
|
true, aIsHttp3, aWebTransport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
uint64_t nsHttpConnectionInfo::GenerateNewWebTransportId() {
|
||||||
|
// Used for generating unique IDSs for dedicated connections, currently used
|
||||||
|
// by WebTransport
|
||||||
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
|
static Atomic<uint64_t> id(0);
|
||||||
|
return ++id;
|
||||||
|
}
|
||||||
|
|
||||||
void nsHttpConnectionInfo::Init(const nsACString& host, int32_t port,
|
void nsHttpConnectionInfo::Init(const nsACString& host, int32_t port,
|
||||||
const nsACString& npnToken,
|
const nsACString& npnToken,
|
||||||
const nsACString& username,
|
const nsACString& username,
|
||||||
|
|||||||
@@ -276,6 +276,8 @@ class nsHttpConnectionInfo final : public ARefBase {
|
|||||||
void SetEchConfig(const nsACString& aEchConfig) { mEchConfig = aEchConfig; }
|
void SetEchConfig(const nsACString& aEchConfig) { mEchConfig = aEchConfig; }
|
||||||
const nsCString& GetEchConfig() const { return mEchConfig; }
|
const nsCString& GetEchConfig() const { return mEchConfig; }
|
||||||
|
|
||||||
|
static uint64_t GenerateNewWebTransportId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init(const nsACString& host, int32_t port, const nsACString& npnToken,
|
void Init(const nsACString& host, int32_t port, const nsACString& npnToken,
|
||||||
const nsACString& username, nsProxyInfo* proxyInfo,
|
const nsACString& username, nsProxyInfo* proxyInfo,
|
||||||
|
|||||||
@@ -152,8 +152,6 @@ class nsHttpConnectionMgr final : public HttpConnectionMgrShell,
|
|||||||
const nsTArray<RefPtr<nsIWebTransportHash>>* GetServerCertHashes(
|
const nsTArray<RefPtr<nsIWebTransportHash>>* GetServerCertHashes(
|
||||||
nsHttpConnectionInfo* aConnInfo);
|
nsHttpConnectionInfo* aConnInfo);
|
||||||
|
|
||||||
uint64_t GenerateNewWebTransportId() { return mMaxWebTransportId++; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~nsHttpConnectionMgr();
|
virtual ~nsHttpConnectionMgr();
|
||||||
|
|
||||||
@@ -471,10 +469,6 @@ class nsHttpConnectionMgr final : public HttpConnectionMgrShell,
|
|||||||
void NotifyConnectionOfBrowserIdChange(uint64_t previousId);
|
void NotifyConnectionOfBrowserIdChange(uint64_t previousId);
|
||||||
|
|
||||||
void CheckTransInPendingQueue(nsHttpTransaction* aTrans);
|
void CheckTransInPendingQueue(nsHttpTransaction* aTrans);
|
||||||
|
|
||||||
// Used for generating unique IDSs for dedicated connections, currently used
|
|
||||||
// by WebTransport
|
|
||||||
Atomic<uint64_t> mMaxWebTransportId{1};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla::net
|
} // namespace mozilla::net
|
||||||
|
|||||||
Reference in New Issue
Block a user