mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-05-20 00:20:13 +00:00
Update the ENet API to support IPv6
This commit is contained in:
+1
-1
Submodule enet updated: 4f7ef11c23...8b24595dbd
@@ -592,18 +592,23 @@ int startControlStream(void) {
|
|||||||
ENetAddress address;
|
ENetAddress address;
|
||||||
ENetEvent event;
|
ENetEvent event;
|
||||||
|
|
||||||
|
// This will do DNS resolution if required
|
||||||
|
if (enet_address_set_host(&address, RemoteAddrString) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
enet_address_set_port(&address, 47999);
|
||||||
|
|
||||||
// Create a client that can use 1 outgoing connection and 1 channel
|
// Create a client that can use 1 outgoing connection and 1 channel
|
||||||
client = enet_host_create(NULL, 1, 1, 0, 0);
|
client = enet_host_create(address.address.ss_family, NULL, 1, 1, 0, 0);
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enet_address_set_host(&address, RemoteAddrString);
|
|
||||||
enet_address_set_port(&address, 47999);
|
|
||||||
|
|
||||||
// Connect to the host
|
// Connect to the host
|
||||||
peer = enet_host_connect(client, &address, 1, 0);
|
peer = enet_host_connect(client, &address, 1, 0);
|
||||||
if (peer == NULL) {
|
if (peer == NULL) {
|
||||||
|
enet_host_destroy(client);
|
||||||
|
client = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,6 +616,10 @@ int startControlStream(void) {
|
|||||||
if (enet_host_service(client, &event, CONTROL_STREAM_TIMEOUT_SEC * 1000) <= 0 ||
|
if (enet_host_service(client, &event, CONTROL_STREAM_TIMEOUT_SEC * 1000) <= 0 ||
|
||||||
event.type != ENET_EVENT_TYPE_CONNECT) {
|
event.type != ENET_EVENT_TYPE_CONNECT) {
|
||||||
Limelog("RTSP: Failed to connect to UDP port 47999\n");
|
Limelog("RTSP: Failed to connect to UDP port 47999\n");
|
||||||
|
enet_peer_reset(peer);
|
||||||
|
peer = NULL;
|
||||||
|
enet_host_destroy(client);
|
||||||
|
client = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -452,15 +452,18 @@ int performRtspHandshake(void) {
|
|||||||
ENetAddress address;
|
ENetAddress address;
|
||||||
ENetEvent event;
|
ENetEvent event;
|
||||||
|
|
||||||
|
// This will do DNS resolution if required
|
||||||
|
if (enet_address_set_host(&address, RemoteAddrString) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
enet_address_set_port(&address, 48010);
|
||||||
|
|
||||||
// Create a client that can use 1 outgoing connection and 1 channel
|
// Create a client that can use 1 outgoing connection and 1 channel
|
||||||
client = enet_host_create(NULL, 1, 1, 0, 0);
|
client = enet_host_create(address.address.ss_family, NULL, 1, 1, 0, 0);
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enet_address_set_host(&address, RemoteAddrString);
|
|
||||||
enet_address_set_port(&address, 48010);
|
|
||||||
|
|
||||||
// Connect to the host
|
// Connect to the host
|
||||||
peer = enet_host_connect(client, &address, 1, 0);
|
peer = enet_host_connect(client, &address, 1, 0);
|
||||||
if (peer == NULL) {
|
if (peer == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user