Commit Graph

1596 Commits

Author SHA1 Message Date
Fletcher Dunn eb6d0678fa ICE client refactor: Interface owns the socket
Simplify GatherInterfaces

Store the interface vector indirectly.  This makes is so that we don't
have to define the move constructors/assignment, needed so that we can
remove items from the list.  Also, looking ahead, I want the callbacks
to have a pointer to their interface, which will remove a little bit
of lookup work, and this will require stable pointers.
2026-05-25 15:00:33 -07:00
Fletcher Dunn bf19de7778 ICE client refactor: delete m_vecHostCandidateSockets
Just store the socket in the corresponding Interface
2026-05-25 15:00:33 -07:00
Fletcher Dunn 9273c5bcc9 ICE client refactor: Delete unused function GetCandidates 2026-05-25 15:00:33 -07:00
Fletcher Dunn de47bdfa0b ICE client: delete dead code 2026-05-25 13:53:47 -07:00
Fletcher Dunn b7d60c2edf ICE client - document state variables 2026-05-24 18:47:57 -07:00
Fletcher Dunn b88a52c206 Fix dangling pointer bug
If there is more than one STUN server and the name is
shorter than std::string small string optimization size.
2026-05-22 22:22:02 -07:00
Fletcher Dunn 951a3a967b Remove unnecessary call to UpdateFakeRateLimitTokenBuckets
This just spends CPU time with no benefit, and also leads to a
(probably harmless) tsan warning
2026-05-22 21:39:19 -07:00
Fletcher Dunn 19fd53901c test_p2p now supports --repeat 2026-05-22 21:26:57 -07:00
Fletcher Dunn 2ca71d516f Add cases that require IPv6 server reflexive to work 2026-05-21 21:58:17 -07:00
Fletcher Dunn 491d224f10 ICE client supports IPv6 server reflexive candidates 2026-05-21 21:57:27 -07:00
Fletcher Dunn 98d4bada61 ResolveHostname can now accept a literal IP or IP:port 2026-05-21 21:56:19 -07:00
Fletcher Dunn 7a871443ed Test STUN server now supports IPv6 2026-05-21 21:54:09 -07:00
Fletcher Dunn 7db494c6e7 Compiler warnings
P4:10650618
(cherry picked from commit f7e8d96de3)
2026-05-18 15:43:46 -07:00
Fletcher Dunn 3ff74eae0e Setup loopback aliases for p2p tests properly 2026-05-18 07:34:44 -07:00
Fletcher Dunn 3060bfd781 Add IPv6 support to p2p mock framework 2026-05-18 00:05:26 -07:00
Fletcher Dunn f4eb1c6403 Tweak output when setting up aliases 2026-05-17 23:16:53 -07:00
Fletcher Dunn c18d9e3d27 test_p2p will muck with the local network stack
To allow us to bind to other addresses besides 127.0.0.1.
We'll need something similar for IPv6, but for now we only
need it for IPv4 on MacOS
2026-05-17 23:05:23 -07:00
Fletcher Dunn 7515a9e00c test_p2p now deliberately selects ICE implementation
Our implementation honors the mock network.  We know that webrtc has
their own very robust mocking framework they put their own implementation
through.
2026-05-17 22:29:48 -07:00
Fletcher Dunn e3ac0ede5e Imrove p2p tests
Make sure we test a super common and important scenario: two hosts
on the same LAN that *also* have the same gateway, and thus could
talk thorugh a hairpinned public route, but should use the LAN
route instead based purely on priority numbers, not latency
2026-05-17 21:49:51 -07:00
Fletcher Dunn 4aefbf6f16 Improve detection of 'probably local' routes
CConnectionTransportP2PICE_Valve::OnConnectionSelected will check the
prefix len
2026-05-17 21:49:46 -07:00
Fletcher Dunn b63a9d606d GetLocalAddresses now also returns the prefix length 2026-05-17 20:54:27 -07:00
Fletcher Dunn 5888b141c2 Delete some stray spew
I guess it's been here for 4 years
2026-05-17 20:02:24 -07:00
Fletcher Dunn d790bd66e2 Improve P2P mocking framework
There can be more than one gateway.  (E.g. cell connection and local
internet connection.)  Each interface is assigned to one gateway,
or none of the interface is public.

Add ability to tag an adapter as non-functioning.

Simulate network latency.

Add more test cases.
2026-05-17 20:01:31 -07:00
Fletcher Dunn 0e18b7dd57 Confirm route type in p2p test
p2p_test.cpp will print the route type
The runner script will extract it and check that the route type is what
we expect
2026-05-13 22:12:22 -07:00
Fletcher Dunn 9a0293e3bb Remove ping check to decide if a route is 'fast' 2026-05-13 22:12:22 -07:00
Fletcher Dunn 6947ea3064 test_p2p: run local STUN server and test several mock cases. 2026-05-13 22:12:22 -07:00
Fletcher Dunn af470f47f6 Add a STUN server 2026-05-13 22:12:21 -07:00
Fletcher Dunn eb25f201c1 test_p2p: Add option to set stun server 2026-05-13 22:12:21 -07:00
Fletcher Dunn 2cb87c1c82 test_p2p.exe: add command line args to setup mock network 2026-05-13 22:12:21 -07:00
Fletcher Dunn 1ca37d421b Add framework for setting a mock network environment 2026-05-13 22:12:20 -07:00
Fletcher Dunn e47e9ff3f1 Add 'test' version of the library
The test version defines STEAMNETWORKINGSOCKETS_ENABLE_MOCK
and has internal functions tests can use to mock up network
environments (network adapters, gateway/NAT behaviour, etc)
2026-05-13 22:12:20 -07:00
Fletcher Dunn f4787850e3 Update vjson submodule to v1.0.1 2026-05-13 22:12:20 -07:00
Fletcher Dunn 66a494746d ICE Client: Don't select a new candidate pair if we already have another selected 2026-05-13 22:12:19 -07:00
Fletcher Dunn 0764699338 ICE Client: Once we have a selected or pair, don't nominate more
The previous check only tested InProgress/Waiting, missing the window where
a pair is nominated but still succeeded (queued for triggered check but not
yet dequeued).
2026-05-13 22:12:19 -07:00
Fletcher Dunn 56983503b5 ICE Client: When we get a candidate, update any pair with that candidate
We might already have the address marked as peer reflexive.
It's probably a host address, and we want to know the 'better' type, so
that we can properly classify the route
2026-05-13 22:12:18 -07:00
Fletcher Dunn 10d4e173db ICE client: delete global state
The global state is not needed, we just use the state of individual
candidate pairs, requests, etc.  It offered a small optimization, but
was mostly a place for bugs to hide.
2026-05-13 22:12:18 -07:00
Fletcher Dunn 5c28eac0eb Break out a few misc things from steamnetworkingsockets_socketthread.cpp
Lock debugging
Timer
Memory override
2026-05-11 18:52:26 -07:00
Fletcher Dunn 72e239af38 Rename file: "lowlevel" to "socketthread" 2026-05-11 17:58:56 -07:00
Fletcher Dunn 55489e5881 Break out spew and task queue into separate files 2026-05-11 17:51:05 -07:00
Fletcher Dunn 1cd8e79ad5 Update vjson pointer to v1.0.0
No real code changes, but it's nice to point to a tag
2026-05-09 15:44:18 -07:00
Fletcher Dunn 0b3406a2d6 Remove picojson submodule
We use vjson now
2026-05-09 10:37:52 -07:00
Fletcher Dunn 01116ad235 Cert tool: use vjson, not picojson 2026-05-09 10:37:51 -07:00
Fletcher Dunn cdb8957a99 Add vjson submodule
I am going to replace the one use of picojson
2026-05-09 10:37:43 -07:00
Fletcher Dunn aa59519c3f Ignore modules folder
In the main branch only!  I will ignore this change in the partner
branch.
2026-05-09 10:37:42 -07:00
Fletcher Dunn e2f9a875d5 Delete old travis files 2026-05-09 07:40:47 -07:00
Fletcher Dunn f9224c168b Fix gcc 2026-05-06 22:34:21 -07:00
Fletcher Dunn 8ac799714d Fix bug decoding reliable message size
P4:10606737
(cherry picked from commit 34fb1433fa)
2026-05-06 22:27:58 -07:00
Fletcher Dunn 4f4804a563 Tweak how tests ignore lock perf warnings 2026-05-06 20:00:29 -07:00
Fletcher Dunn 45c98cc535 Move IThinker::EnsureMinThinkTime out of line
Having it inline was a small speedup, but really not worth the ugly
macros needed to deal with tsan.  (In tsan we need to make sure it
isn't expanded inline in order for the supression to work properly.)
2026-05-06 19:58:29 -07:00
Fletcher Dunn ca404d2f7c Thread sanitizer: Improve detection and supression macros 2026-05-06 19:54:10 -07:00