Commit Graph

126 Commits

Author SHA1 Message Date
Gregory Pappas
e77dad72a5 Bug 1819556 - Remove nsSocketTransportService::ProbeMaxCount r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D183378
2023-07-13 00:28:52 +00:00
Natalia Csoregi
78a9e180c2 Backed out changeset 48bcd4c43c3e (bug 1819556) for causing bustage on nsSocketTransportService2.cpp. CLOSED TREE 2023-07-13 03:21:18 +03:00
Gregory Pappas
9b923f5cc3 Bug 1819556 - Remove nsSocketTransportService::ProbeMaxCount r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D183378
2023-07-12 23:49:22 +00:00
Nika Layzell
c01652d59f Bug 1834640 - Part 2: Properly shutdown nsSocketTransportService during xpcom-shutdown-threads, r=jesup,necko-reviewers
This also cleans up some of the unnecessary flags & memebrs which were held
during the changes in bug 1818998. mSelf was unncessary as the runnable
reference will be keeping the instance alive for the same lifetime, and
mSocketThreadShutDown was redundant with !mInitialized.

This change will also fix a potential issue where the socket thread was not
being shut down when switching the browser into an offline state from
`profile-change-net-teardown`, which could've lead to thread leaks when the
browser is returned to an online state. The restore codepath, however, has
been dead for a long time so this is unlikely to be a real issue in practice.

Depends on D178867

Differential Revision: https://phabricator.services.mozilla.com/D178868
2023-05-26 16:50:22 +00:00
Nika Layzell
12fd335873 Bug 1834640 - Part 1: Add threadsafety annotations to nsSocketTransportService, r=jesup,necko-reviewers
While looking at the relevant code, I noticed the unannotated mutex, and added
some annotations to it. The minor changes I had to do to keep the tree
building after the annotations shouldn't be actual threadsafety issues, as
most of it is either dead code, or exclusively called from the only mutating
thread.

Differential Revision: https://phabricator.services.mozilla.com/D178867
2023-05-26 16:50:22 +00:00
Andi-Bogdan Postelnicu
4efa1bd0ba Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173256
2023-03-27 07:20:25 +00:00
Sandor Molnar
9db345d4c1 Backed out 2 changesets (bug 1276351) for causing build bustage in image/ClippedImage.cp CLOSED TREE
Backed out changeset e84598eb82c1 (bug 1276351)
Backed out changeset e940b0554484 (bug 1276351)
2023-03-25 14:16:43 +02:00
Andi-Bogdan Postelnicu
447f1e3358 Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173256
2023-03-25 06:58:52 +00:00
Iulian Moraru
6d40eee997 Backed out 2 changesets (bug 1276351) for causing multiple failures.
Backed out changeset eeaf4f1e06af (bug 1276351)
Backed out changeset d44cb5704342 (bug 1276351)
2023-03-25 00:08:24 +02:00
Andi-Bogdan Postelnicu
a1b827b503 Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173256
2023-03-24 18:55:39 +00:00
Randell Jesup
db04b44f0e Bug 1818998: Convert nsSocketTransportService polling arrays to nsTArrays r=valentin,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D171043
2023-03-22 14:05:24 +00:00
Cristian Tuns
a4c7b2f0e3 Backed out changeset dc84799cb093 (bug 1818998) for causing xpcshell failures in dom/base/test/unit_ipc/* CLOSED TREE 2023-03-21 14:53:58 -04:00
Randell Jesup
9b0b986c80 Bug 1818998: Convert nsSocketTransportService polling arrays to nsTArrays r=valentin,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D171043
2023-03-21 15:22:17 +00:00
Norisz Fay
abfb5497e3 Backed out 2 changesets (bug 1720594, bug 1818998) for causing leakcheck failures CLOSED TREE
Backed out changeset 9a66f82632b9 (bug 1818998)
Backed out changeset be11e4da5db3 (bug 1720594)
2023-03-16 15:37:50 +02:00
Randell Jesup
9dafe649b4 Bug 1818998: Convert nsSocketTransportService polling arrays to nsTArrays r=valentin,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D171043
2023-03-15 22:13:36 +00:00
Randell Jesup
fcaf70841e Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Noemi Erli
2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup
4b033a5256 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila
927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup
7d4b5fae04 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +00:00
Dragana Damjanovic
985c02c2f1 Bug 1382886 - Use HandshakeDone to signal that a handshake is done r=necko-reviewers,keeler,kershaw
HandshakeDone will be called after a handshake is finished and also after the certificate verifications are done.
The code relies on HandshakeDone to signal that the handshake is done. When early-data is not available HandshakeDone is responsible for setting up a Http2 session if needed. There are 2 outcomes when early-data is used:
1) early-data is accepted and transaction continues polling for read,
2) early-data is rejected. In this case, the transaction is restarted as well as polling flags, i.e. the connection will stop polling for read and start polling for write.
Another difference is that a transaction that is started during the early-data period will behave as a normal transaction, i.e. it will write data and continue polling for read to receive response. The special cases during early-data(mWaitingFor0RTTResponse==true) are removed from nsHttpConnection::OnSocketWritable().

EnsureNPNComplete is only responsible for driving handshake and checking the early-data availability. All logic for finishing a handshake (i.e. checking whether early-data is accepted and checking alpn value) has been moved to HandshakeDone.
The patch also extracts FinishNPNSetup that is responsible for the bookkeeping after a handshake is done or fails, e.g. resetting transactions if 0Rtt is used but handshake fails, updating timings and sending telemetry.

HandshakeDone needs to be dispatched so that it is not called inside nss locks. The side effect of this is that nsHttpConnection::OnSocketWritable() may be called in between  HandshakeDone being dispatched and executed. Therefore we still need to keep CheckCanWrite0RTTData(). This can be fixed in a follow up patch.

Side cleanups:
Remove mNotTrustedMitmDetected - his was used for ESNI, but it is not used anymore

Differential Revision: https://phabricator.services.mozilla.com/D123824
2021-09-22 09:19:31 +00:00
Butkovits Atila
e097708c27 Backed out 7 changesets (bug 1382886) for causing very frequent networking crashes. a=backout DONTBUILD
Backed out changeset e0d76ea1bdd2 (bug 1382886)
Backed out changeset 1db60c600b97 (bug 1382886)
Backed out changeset c922a30d444e (bug 1382886)
Backed out changeset 7f2260b49e60 (bug 1382886)
Backed out changeset 0c049a8ee4a8 (bug 1382886)
Backed out changeset 632eefa7e529 (bug 1382886)
Backed out changeset fe6b8f41ca83 (bug 1382886)
2021-09-18 12:37:24 +03:00
Dragana Damjanovic
72ccc52dcc Bug 1382886 - Use HandshakeDone to signal that a handshake is done r=necko-reviewers,keeler,kershaw
HandshakeDone will be called after a handshake is finished and also after the certificate verifications are done.
The code relies on HandshakeDone to signal that the handshake is done. When early-data is not available HandshakeDone is responsible for setting up a Http2 session if needed. There are 2 outcomes when early-data is used:
1) early-data is accepted and transaction continues polling for read,
2) early-data is rejected. In this case, the transaction is restarted as well as polling flags, i.e. the connection will stop polling for read and start polling for write.
Another difference is that a transaction that is started during the early-data period will behave as a normal transaction, i.e. it will write data and continue polling for read to receive response. The special cases during early-data(mWaitingFor0RTTResponse==true) are removed from nsHttpConnection::OnSocketWritable().

EnsureNPNComplete is only responsible for driving handshake and checking the early-data availability. All logic for finishing a handshake (i.e. checking whether early-data is accepted and checking alpn value) has been moved to HandshakeDone.
The patch also extracts FinishNPNSetup that is responsible for the bookkeeping after a handshake is done or fails, e.g. resetting transactions if 0Rtt is used but handshake fails, updating timings and sending telemetry.

HandshakeDone needs to be dispatched so that it is not called inside nss locks. The side effect of this is that nsHttpConnection::OnSocketWritable() may be called in between  HandshakeDone being dispatched and executed. Therefore we still need to keep CheckCanWrite0RTTData(). This can be fixed in a follow up patch.

Side cleanups:
Remove mNotTrustedMitmDetected - his was used for ESNI, but it is not used anymore

Differential Revision: https://phabricator.services.mozilla.com/D123824
2021-09-17 13:19:01 +00:00
Florian Quèze
998adb18ea Bug 1728760 - require all nsITimerCallback native implementations to also implement nsINamed, r=smaug.
Differential Revision: https://phabricator.services.mozilla.com/D124349
2021-09-07 08:01:18 +00:00
Manuel Bucher
158540519c Bug 1713650 - Fix UDP sockets not showing up in about:networking#sockets r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D122200
2021-08-11 16:07:54 +00:00
Valentin Gosu
1a1f42da37 Bug 1714307 - Run modernize-use-default-member-init --fix check on netwerk r=necko-reviewers,kershaw
This changeset is the result of adding modernize-use-default-member-init to
tools/clang-tidy/config.yaml then proceeding to run
`./mach static-analysis check netwerk/ --fix`
I then went through the resulting fix and manually updated all of the member
variables which were missed due to them having a non-trivial constructor.

Note that the tool was only run on Linux, so code that only runs on some
platforms may have been missed.

The member variables that are still initialized in the contructor definition
are:
  - bitfields (not all currently supported compilers allow default-member-init
  - variables that are initialized via a parameter
  - variables that use code not visible in the header file

There are a few advantages to landing this change:
- fewer lines of code - now declaration is in the same place as initialization
  this also makes it easier to see when looking at the header.
- it makes it harder to miss initializing a member when adding a new contructor
- variables that depend on an include guard look much nicer now

Additionally I removed some unnecessary reinitialization of NetAddr members
(it has a constructor that does that now), and changed nsWifiScannerDBus to
use the thread-safe strtok_r instead of strtok.

Differential Revision: https://phabricator.services.mozilla.com/D116980
2021-06-11 07:10:41 +00:00
Csoregi Natalia
938a6943c6 Backed out changeset 6e00f8bd2acc (bug 1714307) for causing hazard bustage. CLOSED TREE 2021-06-09 21:50:03 +03:00
Valentin Gosu
d1513f313e Bug 1714307 - Run modernize-use-default-member-init --fix check on netwerk r=necko-reviewers,kershaw
This changeset is the result of adding modernize-use-default-member-init to
tools/clang-tidy/config.yaml then proceeding to run
`./mach static-analysis check netwerk/ --fix`
I then went through the resulting fix and manually updated all of the member
variables which were missed due to them having a non-trivial constructor.

Note that the tool was only run on Linux, so code that only runs on some
platforms may have been missed.

The member variables that are still initialized in the contructor definition
are:
  - bitfields (not all currently supported compilers allow default-member-init
  - variables that are initialized via a parameter
  - variables that use code not visible in the header file

There are a few advantages to landing this change:
- fewer lines of code - now declaration is in the same place as initialization
  this also makes it easier to see when looking at the header.
- it makes it harder to miss initializing a member when adding a new contructor
- variables that depend on an include guard look much nicer now

Additionally I removed some unnecessary reinitialization of NetAddr members
(it has a constructor that does that now), and changed nsWifiScannerDBus to
use the thread-safe strtok_r instead of strtok.

Differential Revision: https://phabricator.services.mozilla.com/D116980
2021-06-09 10:20:04 +00:00
Valentin Gosu
d595491cc7 Bug 1714307 - Autofix static-analysis warnings in netwerk/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D116701
2021-06-04 12:35:16 +00:00
Butkovits Atila
692bda1ca1 Backed out changeset c4b44c4ef15b (bug 1714307) for causing build bustages on nsHTTPCompressConv.h. CLOSED TREE 2021-06-04 13:53:37 +03:00
Valentin Gosu
98146ae90b Bug 1714307 - Autofix static-analysis warnings in netwerk/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D116701
2021-06-04 10:00:55 +00:00
Kershaw Chang
628b4518df Bug 1667743 - Remove unused esni code r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D98023
2020-12-03 12:17:12 +00:00
Bogdan Tara
520f54fb37 Backed out changeset 117da9de7f66 (bug 1667743) for handshakeSucceeded related bustage CLOSED TREE 2020-12-03 03:44:59 +02:00
Kershaw Chang
14d936a94d Bug 1667743 - Remove unused esni code r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D98023
2020-12-02 23:18:38 +00:00
Byron Campen [:bwc]
d9e2987cba Bug 1626278: Shutdown MediaTransportHandlerSTS on STS shutdown. Also add some logging. r=mjf,valentin
Differential Revision: https://phabricator.services.mozilla.com/D93655
2020-11-19 18:57:42 +00:00
Sebastian Hengst
0cf7e55237 Backed out changeset 0b7c8f6349b1 (bug 1667743) on request from kershaw for causing bug 1667801 2020-09-30 13:12:53 +02:00
Kershaw Chang
5eabf77a18 Bug 1667743 - Remove unused esni code r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D91571
2020-09-28 17:21:39 +00:00
Jean-Yves Avenard
735a4b5c2c Bug 1648898 - Fix data race on STS loop start. r=mayhemer
The STS dispatched the first event before setting mThread member. It was possible that the STS::Run() task got started before mThread was set and causing one of the nsISerialEventTarget methods to read mThread/mInitialised/mShuttingDown value as null or zero and they would have returned an error.

We rewrite and simplify the access to mThread such that it's a lockless operation.

ApplyPortRemapPreference assert that it's running on the taskqueue; however if called before initialization, it would have been run on whatever thread called ApplyPortRemap.

Differential Revision: https://phabricator.services.mozilla.com/D81334
2020-06-30 11:06:31 +00:00
Narcis Beleuzu
b151157eee Backed out changeset f16199c7d45e (bug 1648898) for causing Bug 1649333 . CLOSED TREE 2020-06-30 09:57:42 +03:00
Jean-Yves Avenard
6ca26ca6d3 Bug 1648898 - Fix data race on STS loop start. r=mayhemer
The STS dispatched the first event before setting mThread member. It was possible that the STS::Run() task got started before mThread was set and causing one of the nsISerialEventTarget methods to read mThread/mInitialised/mShuttingDown value as null or zero and they would have returned an error.

We rewrite and simplify the access to mThread such that it's a lockless operation.

ApplyPortRemapPreference assert that it's running on the taskqueue; however if called before initialization, it would have been run on whatever thread called ApplyPortRemap.

Differential Revision: https://phabricator.services.mozilla.com/D81334
2020-06-29 22:59:20 +00:00
Jean-Yves Avenard
a943b8c10a Bug 1644009 - P12. Make STS thread supports nsIDirectTaskDispatcher interface. r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D79105
2020-06-12 05:10:47 +00:00
Jean-Yves Avenard
d3f369570f Bug 1644009 - P3. Revert "Bug 1592488 - P8. Ensure AbstractThread exists with STS thread." r=valentin,necko-reviewers
DirectTask dispatching will now be directly handled by nsThread.

Differential Revision: https://phabricator.services.mozilla.com/D79087
2020-06-12 05:09:40 +00:00
Jean-Yves Avenard
bbe6a0bfb5 Bug 1592488 - P8. Ensure AbstractThread exists with STS thread. r=valentin,necko-reviewers
This is necessary to ensure we can use IPC MozPromise with this target thread that requires direct tasks dispatch.

Differential Revision: https://phabricator.services.mozilla.com/D74595
2020-05-12 10:43:35 +00:00
Simon Giesecke
9600160bc6 Bug 1626570 - Improve handling of copying arrays in netwerk/base/. r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D72346
2020-05-05 10:40:36 +00:00
Razvan Maries
c2b627950c Backed out 10 changesets (bug 1626570) for build bustages. CLOSED TREE
Backed out changeset a3f17d392234 (bug 1626570)
Backed out changeset 5247e1ddd5d6 (bug 1626570)
Backed out changeset c339fd44c9f8 (bug 1626570)
Backed out changeset 4c69a4c013b3 (bug 1626570)
Backed out changeset e85450d69351 (bug 1626570)
Backed out changeset 793f978248b3 (bug 1626570)
Backed out changeset 68b4c2418d83 (bug 1626570)
Backed out changeset 52d0911d4ad3 (bug 1626570)
Backed out changeset a7d4e3a59ee3 (bug 1626570)
Backed out changeset 6c06d397a5d2 (bug 1626570)
2020-05-05 13:37:08 +03:00
Simon Giesecke
aff3831e1e Bug 1626570 - Improve handling of copying arrays in netwerk/base/. r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D72346
2020-05-05 09:13:31 +00:00
Andrew McCreight
4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Honza Bambas
13a16f0e2d Bug 1596799 - Have a preference to force remote TCP/UDP port remapping for easier local network testing, r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D59917

--HG--
extra : moz-landing-system : lando
2020-01-16 17:22:36 +00:00
Dorel Luca
d29d22d6dc Backed out changeset 84f69fc66690 (bug 1596799) for Browser-chrome failures in /builds/worker/workspace/build/src/netwerk/base/nsSocketTransportService2.cpp. CLOSED TREE 2020-01-15 21:31:46 +02:00
Honza Bambas
0e35da72e0 Bug 1596799 - Have a preference to force remote TCP/UDP port remapping for easier local network testing, r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D59917

--HG--
extra : moz-landing-system : lando
2020-01-15 18:30:42 +00:00