Commit Graph
132 Commits
Author SHA1 Message Date
Cameron Gutman 348d5d1e32 Fix potential leaks on queue shutdown 2026-11-10 21:03:51 -06:00
Cameron Gutman 3387805deb Consistently handle the frame index as 32-bit 2026-11-10 20:21:33 -06:00
fidoboy e80a786afe Handle ENet disconnects with short headers 2026-11-03 01:26:25 -06:00
Cameron Gutman f050b13b6a Add explicit cast to make MSVC happy 2026-11-01 15:11:58 -06:00
Cameron Gutman 7d61e2d95f Don't provide ENet backpressure when sending large payloads 2026-11-01 15:07:59 -06:00
Cameron Gutman 4853e70489 Add jumbo control stream messages for larger than 16-bit payloads 2026-11-01 15:07:12 -06:00
Cameron Gutman c7dff22963 Add replay detection to RTSP and control streams
Replays can do very little harm in these contexts, but let's detect and prevent them anyways.

Fixes #165
Closes #170
2026-11-01 14:07:45 -06:00
Sergey Shunko 5d3c0ecca0 Add missing IDX_DS_ADAPTIVE_TRIGGERS sentinel to packetTypesGen3..7 2026-10-26 17:46:48 -05:00
Chris 41cedb89d6 Only intercept ENet disconnects addressed to our peer (#162)
ignoreDisconnectIntercept() runs on every datagram the control stream
socket receives, before ENet has validated the packet. It only checked
the length and command, so any 12-byte DISCONNECT from any source set
disconnectPending, which tears down the session about a second later.

Check that the header's peer ID and session ID match our peer and that
the packet came from the peer's current address before acting on it.
Anything else is passed to ENet unchanged, so a genuine disconnect that
does not match (for example from another address of a multi-homed
host) is still handled, just without the grace period.
2026-10-24 18:16:28 -05:00
Cameron Gutman 342b106bbb Perform control stream encryption in-place 2026-10-19 01:10:46 -05:00
Cameron Gutman e2722dc837 Fix uninitialized stack data in the periodic ping payload 2026-10-12 23:31:33 -05:00
ns6089 2a5a1f3e8a Add support for LTR ACK control messages (#122)
* Add support for LTR ACK control messages
2026-01-20 21:47:38 -06:00
Cameron Gutman 20c05eda6a Don't lock the ENet mutex when querying for RTT information 2025-11-25 17:26:01 -06:00
Cameron Gutman 84f37631c2 Add ByteBuffer APIs for reading/writing multiple bytes 2025-06-08 15:46:47 -05:00
ABeltramo e95feaf495 Protocol extension: DualSense adaptive trigger support (#102) 2025-03-25 18:16:11 -05:00
Cameron Gutman d3d3e6cf01 Port improved ping interval logic into the control receive loop 2024-10-20 17:34:35 -05:00
Cameron Gutman 9686f6942f Consolidate PltCloseThread() and PltJoinThread() 2024-02-17 18:14:03 -06:00
Cameron Gutman fb2b103e51 Fix propagation of errors from enet_host_service() in sendMessageEnet() 2024-01-24 22:41:03 -06:00
Cameron Gutman a517f7cbca Fix -Wsign-compare warnings in debug build 2024-01-18 21:35:20 -06:00
zoey jodon c104a97fa0 Add platform support for the 3DS
Prevent wildcard port binding on the 3DS
Add 3DS threading logic
Add 3DS socket logic
Bump the connection timeout to 60s for the 3DS
2024-01-18 18:30:20 -06:00
Cameron Gutman 2597b5e779 Use a 12-byte AES-GCM IV for the new encryption features 2024-01-18 18:29:47 -06:00
Cameron Gutman 6083a75d1b Ensure no IV collisions 2024-01-14 13:18:22 -06:00
Cameron Gutman 3430ee2c3a Add control stream encryption v2 support 2024-01-14 12:58:48 -06:00
Cameron Gutman 723cac034b Discard unencrypted packets on encrypted control stream 2024-01-14 11:41:01 -06:00
Cameron Gutman 6e9ed871bc Add support for X-SS-Connect-Data in RTSP SETUP for control stream
This allows the host to provide a 32-bit integer that will be sent
in the data of the ENet connect event, similar to X-SS-Ping-Payload
for video and audio.

The host can use this data to uniquely identify a client when IP
addresses are not stable across the various separate connections,
such as when the client is behind a Carrier-Grade NAT.
2023-12-28 16:56:06 -06:00
Cameron Gutman 3aae4cdc59 Improve ENet socket error propagation for better debuggability 2023-12-22 13:45:50 -06:00
Cameron Gutman 5de4a5b85a Bind the control stream socket to the local address used for other UDP traffic 2023-10-26 01:27:31 -05:00
Cameron Gutman 05c3f9c754 Bind our UDP sockets to the same local address used by RTSP handshake
This means we can ensure a consistent local address for our outgoing PING
traffic to keep the UDP flows alive without having to call connect() which breaks
with multi-homed hosts on GFE and Sunshine v0.20 and earlier.
2023-10-26 01:09:26 -05:00
Cameron Gutman 5e844aad08 Fix UBSan warning for signed integer overflow 2023-10-11 20:09:48 -05:00
Cameron Gutman 620b4be477 Add separate LC_ASSERT_VT() for asserts that only apply for valid traffic 2023-10-11 20:01:39 -05:00
Cameron Gutman c1744de069 Batch async control stream callbacks 2023-09-18 23:02:44 -05:00
Cameron Gutman 20130e210b Invoke control stream callbacks on a separate thread
Time spent processing client callbacks would contribute to increased control stream latency,
which means higher RTTs, more lengthy waits before retransmissions, and higher client-reported
network latency stats.
2023-09-17 14:49:06 -05:00
Cameron Gutman 515bea6fb4 Fix GCC static analysis warnings 2023-09-15 22:03:27 -05:00
Cameron Gutman 2bb026c763 Suppress connection warnings for the first sampling period 2023-08-23 21:03:40 -05:00
Cameron Gutman dc62a6f88e Send periodic pings and FEC status messages more frequently 2023-08-19 11:39:55 -05:00
Cameron Gutman 78e06eb613 Batch control stream messages 2023-08-19 11:27:16 -05:00
Cameron Gutman f2cea4d6b0 Update ENet submodule 2023-07-30 14:02:28 -05:00
Cameron Gutman 6d039a646b Fix extended delays for unreliable/unsequenced traffic on high latency connections 2023-07-25 23:30:45 -05:00
Cameron Gutman 2ac25bebaa Send unreliable traffic as reliable when we have just one channel 2023-07-16 15:11:09 -05:00
Cameron Gutman f3b7edbd11 Overflow onto channel 0 rather than distributing
This allows the host to make some assumptions about channel IDs
2023-07-04 16:51:35 -05:00
Cameron Gutman 377d37503f Split controller motion events onto their own channels 2023-07-04 16:18:52 -05:00
Cameron Gutman c8828d586c Don't send periodic pings as reliable traffic 2023-07-04 15:03:01 -05:00
Cameron Gutman 0095141e08 Split control data into multiple channels and optimize packet flags based on type of data
This can significantly performance on lossy networks by avoiding HOL blocking.
2023-07-04 14:49:21 -05:00
Cameron Gutman a0f8c060c0 Introduce new protocol extensions for controller RGB LEDs and battery state 2023-07-02 14:38:54 -05:00
Cameron Gutman ce98d4fb2f Introduce connection callbacks for trigger rumble and motion events 2023-06-11 19:42:02 -05:00
Cameron Gutman 7e089435c7 Reduce max number of frame status reports per second 2023-02-20 16:48:12 -06:00
Cameron Gutman 55a6d58225 Fix leak 2023-02-20 16:42:23 -06:00
Cameron Gutman 207f981fd0 Send final FEC frame status info to Sunshine
This info will be used for dynamic FEC and dynamic video packet batch size.
2023-02-20 16:24:48 -06:00
Cameron Gutman 82105f2f8f Declare packetFreed as volatile 2023-02-15 01:42:48 -06:00
Cameron Gutman 54d46ca80f Put backpressure on control stream sender when the window fills up
Without any backpressure, ENet will just let packets accumulate forever.
2023-02-14 23:02:18 -06:00