1932 Commits
Author SHA1 Message Date
Fletcher Dunn f4e66f83bf Fix -Wundef warning for TARGET_OS_IOS on older Apple SDKs
(cherry picked from commit 98d8d95aa1)
2026-05-28 19:39:36 -07:00
Fletcher Dunn 6f0b185b9f Fix compiler warnings if DBGFLAG_ASSERT not defined
(cherry picked from commit 39a50f40f7)
2026-05-28 19:39:29 -07:00
Fletcher Dunn eaf9695635 Don't use make_unique, we want to support cxx11 as long as we can
(cherry picked from commit e9832ac1af)
2026-05-28 19:29:19 -07:00
Fletcher Dunn b71c834864 Merge with master at 91465451d0 2026-05-28 15:54:29 -07:00
Fletcher Dunn 6c164c4548 Fix windows
(cherry picked from commit c9d48c76d0)
2026-05-28 15:48:02 -07:00
Fletcher Dunn a30ccfbf63 ICE client: fix retrigger
Sometimes the RFC algorithm wants you to immediately 'retrigger' a
candidate check.  The previous code was deleting the previous request
and creating a new one.  But this means that any reply that comes in
cannot get matched up, because the new request will get a new
transaction ID.  In general, I think any time we cancel a request and
throw it away, it is probably a mistake, because the reply that comes
back contains useful information, and if we throw away the request, we
won't be able to match it up by transaction ID and remember what we were
doing, so we lose that information.

This can be catastrophic.  The Mac CI was failing because of a timing
issue where each side would 'retrigger' its request just before the
reply to the previous request arrived.  All of the responses were
getting dropped because they could not be matched up by transaction ID.

The new code just resets the retransmission timer, causing us to send it
immediately and also resets the exponential backoff schedule.

Also, simplify some logic and tweak formatting.

(cherry picked from commit f539edb097)
2026-05-28 15:48:01 -07:00
Fletcher Dunn 66b63b5758 ICE client: tweak spew
(cherry picked from commit 85be74feee)
2026-05-28 15:48:00 -07:00
Fletcher Dunn 903fdcd542 test_p2p.py: Add symmetric test that requires TURN
(cherry picked from commit bde7c7b858)
2026-05-28 15:48:00 -07:00
Fletcher Dunn f10228335d ICE client: Apply two candidate processing rules from the RFC
(cherry picked from commit 311ce2ea50)
2026-05-28 15:47:59 -07:00
Fletcher Dunn 94fc4a809f ICE client: Fix route determination
It needs the local candidate (with the relay, if present), not just the
interface.  And check for either candidate being relayed, then route is
relayed.

(cherry picked from commit 6776f82e78)
2026-05-28 15:47:58 -07:00
Fletcher Dunn 256f4fe076 Test STUN/TURN server: Add --relay-latency arg, use 75ms in tests
This helps make sure that relayed routes don't win a race, and we
can use the naive RFC algorithm and confirm that we get the route
type that we expect

(cherry picked from commit 53b6ca0a22)
2026-05-28 15:47:57 -07:00
Fletcher Dunn 507827374d ICE client: Basic TURN server support is working
(cherry picked from commit da51fe5665)
2026-05-28 15:47:56 -07:00
Fletcher Dunn 91ffeb522c ICE client: more progress on TURN server support
Add ICELocalCandidate.  This was deleted earlier, because it had a bunch
of extra stuff that we don't care about when comparing if two local
candidates are the same.  Essentially if we send diretcly from our
socket, then we don't really care what kind of candidate it is to the
peer.  But we do really need to distinguish between local candidates
that are relayed.

Add ICESessionInterface::SendPacketGather, which knows how to wrap a
data packet in a k_nTURN_SendIndication

Check for k_nTURN_DataIndication from TURN servers.  This doesn't work
fully right now.

(cherry picked from commit 19be4d372a)
2026-05-28 15:47:45 -07:00
Fletcher Dunn 61554c8c3b ICE client: Small cleanup
Delete unused function
Don't dynamically allocate any attributes passed to SendSTUNResponsePacket

(cherry picked from commit ea2b3842c6)
2026-05-28 15:47:44 -07:00
Fletcher Dunn 363aa8f756 ICE client refactor: simplify packet sending
Really, the separation between CSteamNetworkingICESession and
CConnectionTransportP2PICE_Valve is just not very useful and
those classes should be merged.

(cherry picked from commit 9aed2eb8c2)
2026-05-28 15:47:44 -07:00
Fletcher Dunn ff64b7ab86 ICE client: Send TURN CreatePermission requests
(cherry picked from commit f266d3138b)
2026-05-28 15:47:43 -07:00
Fletcher Dunn 48ab6024ee ICE client: simplify STUN/TURN requests
- Move 'factory' functions to be methods on ICESessionInterface
- Delete CRecvSTUNPktCallback, callback can be just a simple pointer to
  method
- Serialize the request once instead of saving off attributes and
  complicated memorty management.

(cherry picked from commit e09fbc9616)
2026-05-28 15:47:42 -07:00
Fletcher Dunn 38405fa4ba ICE client: Add logic to gather relay candidates from TURN servers
(cherry picked from commit d41a4db85c)
2026-05-28 15:47:41 -07:00
Fletcher Dunn 7fed305454 test_p2p.cpp now understands --turn-server
(cherry picked from commit ea9c4ade95)
2026-05-28 15:47:40 -07:00
Fletcher Dunn 709855358e Test STUN server now supports minimal TURN features
(cherry picked from commit 75f621aadb)
2026-05-28 15:47:40 -07:00
Fletcher Dunn 0472bc02a8 ICE client refactor: Delete list of local candidates
And we don't need ICELocalCandidate at all any more.
This is so much simpler.

(cherry picked from commit e5b4615d2e)
2026-05-28 15:44:59 -07:00
Fletcher Dunn 91465451d0 vcpkg fixes
vcpkg manigest:
- Add vcpkg-cmake as dependency of this project
- Don't support bcrypt as vcpkg feature.  Nobody using vcpkg wants bcrypt,
  so this is just a trap.

Local/test overlay port:
- Fix how we are setting SOURCE_PATH
- Add symlink to out vcpkg.json manifest, since a port needs one

Chat example built using vcpkg:
- Add GNS_LINK_STATIC option to vcpkg_example_chat project so I can test
  an app linking against static or dynamic lib.
2026-05-28 14:41:44 -07:00
Fletcher Dunn 495094583f Correct version in our vcpkg manifest 2026-05-28 09:42:16 -07:00
Fletcher Dunn c9d48c76d0 Fix windows 2026-05-27 23:35:24 -07:00
Fletcher Dunn f539edb097 ICE client: fix retrigger
Sometimes the RFC algorithm wants you to immediately 'retrigger' a
candidate check.  The previous code was deleting the previous request
and creating a new one.  But this means that any reply that comes in
cannot get matched up, because the new request will get a new
transaction ID.  In general, I think any time we cancel a request and
throw it away, it is probably a mistake, because the reply that comes
back contains useful information, and if we throw away the request, we
won't be able to match it up by transaction ID and remember what we were
doing, so we lose that information.

This can be catastrophic.  The Mac CI was failing because of a timing
issue where each side would 'retrigger' its request just before the
reply to the previous request arrived.  All of the responses were
getting dropped because they could not be matched up by transaction ID.

The new code just resets the retransmission timer, causing us to send it
immediately and also resets the exponential backoff schedule.

Also, simplify some logic and tweak formatting.
2026-05-27 22:53:43 -07:00
Fletcher Dunn 85be74feee ICE client: tweak spew 2026-05-27 21:15:06 -07:00
Fletcher Dunn bde7c7b858 test_p2p.py: Add symmetric test that requires TURN 2026-05-27 20:57:23 -07:00
Fletcher Dunn 311ce2ea50 ICE client: Apply two candidate processing rules from the RFC 2026-05-27 20:57:18 -07:00
Fletcher Dunn 6776f82e78 ICE client: Fix route determination
It needs the local candidate (with the relay, if present), not just the
interface.  And check for either candidate being relayed, then route is
relayed.
2026-05-27 20:55:29 -07:00
Fletcher Dunn 53b6ca0a22 Test STUN/TURN server: Add --relay-latency arg, use 75ms in tests
This helps make sure that relayed routes don't win a race, and we
can use the naive RFC algorithm and confirm that we get the route
type that we expect
2026-05-27 20:55:29 -07:00
Fletcher Dunn da51fe5665 ICE client: Basic TURN server support is working 2026-05-27 20:54:19 -07:00
Fletcher Dunn 19be4d372a ICE client: more progress on TURN server support
Add ICELocalCandidate.  This was deleted earlier, because it had a bunch
of extra stuff that we don't care about when comparing if two local
candidates are the same.  Essentially if we send diretcly from our
socket, then we don't really care what kind of candidate it is to the
peer.  But we do really need to distinguish between local candidates
that are relayed.

Add ICESessionInterface::SendPacketGather, which knows how to wrap a
data packet in a k_nTURN_SendIndication

Check for k_nTURN_DataIndication from TURN servers.  This doesn't work
fully right now.
2026-05-27 16:08:50 -07:00
Fletcher Dunn ea2b3842c6 ICE client: Small cleanup
Delete unused function
Don't dynamically allocate any attributes passed to SendSTUNResponsePacket
2026-05-27 16:01:18 -07:00
Fletcher Dunn 9aed2eb8c2 ICE client refactor: simplify packet sending
Really, the separation between CSteamNetworkingICESession and
CConnectionTransportP2PICE_Valve is just not very useful and
those classes should be merged.
2026-05-27 11:54:27 -07:00
Fletcher Dunn f266d3138b ICE client: Send TURN CreatePermission requests 2026-05-27 11:16:30 -07:00
Fletcher Dunn e09fbc9616 ICE client: simplify STUN/TURN requests
- Move 'factory' functions to be methods on ICESessionInterface
- Delete CRecvSTUNPktCallback, callback can be just a simple pointer to
  method
- Serialize the request once instead of saving off attributes and
  complicated memorty management.
2026-05-27 10:10:37 -07:00
Fletcher Dunn d41a4db85c ICE client: Add logic to gather relay candidates from TURN servers 2026-05-27 08:39:55 -07:00
Fletcher Dunn ea9c4ade95 test_p2p.cpp now understands --turn-server 2026-05-27 08:33:55 -07:00
Fletcher Dunn 75f621aadb Test STUN server now supports minimal TURN features 2026-05-27 08:33:52 -07:00
Fletcher Dunn e5b4615d2e ICE client refactor: Delete list of local candidates
And we don't need ICELocalCandidate at all any more.
This is so much simpler.
2026-05-26 23:45:40 -07:00
Fletcher Dunn fdf9d4a157 Merge with master at 6f6419084e 2026-05-26 18:09:54 -07:00
Fletcher Dunn 3fdd5493a8 ICE client refactor: Simplify
Delete UpdateHostCandidates, just create the host candidate immediately
when we create the interface.

Also delete ICECandidateBase::CalcPriority.  We only called that when
adding a new local candidate, so just do the work directly in the
constructor.

(cherry picked from commit 6f6419084e)
2026-05-26 13:26:31 -07:00
Fletcher Dunn f3281bbcf7 ICE client refactor: ICECandidatePair stores local interface
Not the local candidate!  A "local candidate" is a thing that we need to
tell our peer about, but when we need to send or receive packets, we
use a socket.  When a socket has a host candidate, a server reflexive
candidate, etc, we don't really know or care which of those candidates
the peer used to talk to us.

Also, deleted IsCandidatePermitted.  We need this, but the place we were
calling it was wrong.

(cherry picked from commit e735bc0329)
2026-05-26 13:26:30 -07:00
Fletcher Dunn f1dfacc72d ICE client refactor: simplify parsing flow
Delete UnpackSTUNHeader and IsValidSTUNHeader.  Combine them and
expand them inline at the only place we need to do this.

Rename DecodeSTUNPacket to ParseSTUNAttributes.  It will get a copy
of the header already parsed, and will assume that the packet has
already been verified to be STUN.

Rename CSteamNetworkingSocketsSTUNRequest::OnPacketReceived to
ReplyPacketReceived and pass in what we have already parsed.
Delete return value, which was unused by only call site also
referred to silly nonsensical constants

(cherry picked from commit fd500ef8ba)
2026-05-26 13:26:29 -07:00
Fletcher Dunn c6c752e5e4 ICE client refactor: Each Interface knows what session owns it
Socket callback will be the interface pointer, which gives us
a little bit more context and makes a few things simpler.

(cherry picked from commit 60314c1606)
2026-05-26 13:26:29 -07:00
Fletcher Dunn b4592f126a ICE client refactor: Delete ICELocalCandidate::m_base
(cherry picked from commit 2a9bedc599)
2026-05-26 13:26:28 -07:00
Fletcher Dunn 675ea5580d ICE client refactor: local candidates remember the interface
This removes several places where we need to lookup the interface.
But since we are storing a pointer, it means now we need to make sure
and carefully cleanup if an interface drops out of the interface list.

(cherry picked from commit 3d29fc0a08)
2026-05-26 13:26:27 -07:00
Fletcher Dunn d0ed9d1c35 ICE client refactor: Move m_base to local candidate only
(cherry picked from commit 14e01af87d)
2026-05-26 13:26:26 -07:00
Fletcher Dunn 295ff60113 ICE client refactor: candidate type from address not base
(cherry picked from commit 47300da67b)
2026-05-26 13:26:26 -07:00
Fletcher Dunn 017add5c80 ICE client refactor: Candidate type enum
There was a nested type CSteamNetworkingICESession::ICECandidateType,
which was named very confusingly similar to EICECandidateType.  That
type uses different enum values based on the address family.

Renamed it to ICECandidateKind, made it an enum class, and promoted
to global scope.

Also, moved RFC5245CandidateAttr so we don't have to forward declare
it.

(cherry picked from commit 9032a75a17)
2026-05-26 13:26:25 -07:00