Bug 1706377 - Call VerifyTraffic for every network change event, r=necko-reviewers,valentin

For mozvpn, the data received in network change event is "up", not "changed", so we should call VerifyTraffic for every event for safe.
This patch also reduces http2.ping-timeout and http2.ping-threshold, since the original values are too long.

Differential Revision: https://phabricator.services.mozilla.com/D179681
This commit is contained in:
Kershaw Chang 2023-06-06 08:20:26 +00:00
Родитель ae0257ca20
Коммит b8fe0dda5f
3 изменённых файлов: 15 добавлений и 14 удалений

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

@ -12398,12 +12398,12 @@
- name: network.http.http2.ping-threshold
type: RelaxedAtomicInt32
value: 58
value: 20
mirror: always
- name: network.http.http2.ping-timeout
type: RelaxedAtomicInt32
value: 8
value: 5
mirror: always
- name: network.http.http2.send-buffer-size

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

@ -2145,6 +2145,9 @@ nsresult Http2Session::RecvPing(Http2Session* self) {
if (self->mInputFrameFlags & kFlag_ACK) {
// presumably a reply to our timeout ping.. don't reply to it
self->mPingSentEpoch = 0;
// We need to reset mPreviousUsed. If we don't, the next time
// Http2Session::SendPing is called, it will have no effect.
self->mPreviousUsed = false;
} else {
// reply with a ack'd ping
self->GeneratePing(true);
@ -4328,6 +4331,7 @@ nsresult Http2Session::PushBack(const char* buf, uint32_t len) {
void Http2Session::SendPing() {
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
LOG(("Http2Session::SendPing %p mPreviousUsed=%d", this, mPreviousUsed));
if (mPreviousUsed) {
// alredy in progress, get out

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

@ -2141,18 +2141,15 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
mAltSvcCache->ClearAltServiceMappings();
}
} else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
nsAutoCString converted = NS_ConvertUTF16toUTF8(data);
if (!strcmp(converted.get(), NS_NETWORK_LINK_DATA_CHANGED)) {
if (mConnMgr) {
rv = mConnMgr->PruneDeadConnections();
if (NS_FAILED(rv)) {
LOG((" PruneDeadConnections failed (%08x)\n",
static_cast<uint32_t>(rv)));
}
rv = mConnMgr->VerifyTraffic();
if (NS_FAILED(rv)) {
LOG((" VerifyTraffic failed (%08x)\n", static_cast<uint32_t>(rv)));
}
if (mConnMgr) {
rv = mConnMgr->PruneDeadConnections();
if (NS_FAILED(rv)) {
LOG((" PruneDeadConnections failed (%08x)\n",
static_cast<uint32_t>(rv)));
}
rv = mConnMgr->VerifyTraffic();
if (NS_FAILED(rv)) {
LOG((" VerifyTraffic failed (%08x)\n", static_cast<uint32_t>(rv)));
}
}
} else if (!strcmp(topic, "application-background")) {