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.
This commit is contained in:
Cameron Gutman
2023-10-26 01:09:26 -05:00
parent c86f49ee7f
commit 05c3f9c754
10 changed files with 66 additions and 40 deletions

View File

@@ -1597,7 +1597,7 @@ int startControlStream(void) {
LC_ASSERT(ControlPortNumber != 0);
enet_address_set_address(&address, (struct sockaddr *)&RemoteAddr, RemoteAddrLen);
enet_address_set_address(&address, (struct sockaddr *)&RemoteAddr, AddrLen);
enet_address_set_port(&address, ControlPortNumber);
// Create a client
@@ -1665,7 +1665,7 @@ int startControlStream(void) {
else {
// NB: Do NOT use ControlPortNumber here. 47995 is correct for these old versions.
LC_ASSERT(ControlPortNumber == 0);
ctlSock = connectTcpSocket(&RemoteAddr, RemoteAddrLen,
ctlSock = connectTcpSocket(&RemoteAddr, AddrLen,
47995, CONTROL_STREAM_TIMEOUT_SEC);
if (ctlSock == INVALID_SOCKET) {
stopping = true;