1632 Commits

Author SHA1 Message Date
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
Fletcher Dunn d907a1da6c test_p2p: missing add_sanitizers 2026-05-06 19:50:00 -07:00
Fletcher Dunn 1d3a483408 Add a hack to try to fix tsan 2026-05-05 22:07:09 -07:00
Fletcher Dunn b81c19c31e Fix endian handling issues
Fix missing paren.  (I bet this code has never actualy been tested.)

Add size checks in NOP LittleXxx and BigXxxx macros, so we always check
the size, not just when we need to swap.

Delete fallback if neither endian define is defined.  That just hides a
potential problem.
2026-05-05 22:01:49 -07:00
Fletcher Dunn 1459f1029d Add cast to fix passing wrong size to LittleWord 2026-05-05 21:58:51 -07:00
Fletcher Dunn 3a5e463b51 Delete old / useless stuff
I don't want to support MinGW.
2026-05-04 12:26:29 -07:00
Fletcher Dunn 2a40b7a652 Tweak lock warning thresholds to fix tests 2026-05-04 10:16:47 -07:00
Fletcher Dunn a7a115f6e9 Add ATTR_NO_SANITIZE_THREAD and use it to silence a tsan warning 2026-05-04 08:35:17 -07:00
Fletcher Dunn 380c380f82 Increase lock warnings under tsan even more 2026-05-03 23:23:29 -07:00
Fletcher Dunn 41283275b6 Greatly increase warning thresholds in tsan 2026-05-03 22:54:39 -07:00
Fletcher Dunn e15f7e3fa3 Add tsan suppression 2026-05-03 22:34:19 -07:00
Fletcher Dunn db30f1b139 Fix protobuf find_package fallback when config mode unavailable
When CMake's FindProtobuf module is used as a fallback (e.g. when building
as a git submodule without vcpkg), it creates Protobuf::libprotobuf (capital
P) rather than protobuf::libprotobuf. Add an alias so both code paths work.

This fixes #367
2026-05-03 22:21:51 -07:00
Fletcher Dunn 303272bcdd Add specific tsan build/run 2026-05-03 22:04:11 -07:00
Fletcher Dunn cd704e719b Reorder lock and assert to fix tsan warning 2026-05-03 22:02:01 -07:00
Fletcher Dunn 7b2d3c9293 Delete a bunch of old unused defines
They are conflicting with minGW.

Fixes #305
2026-05-03 21:29:56 -07:00