diff --git a/enet b/enet index 4f7ef11..8b24595 160000 --- a/enet +++ b/enet @@ -1 +1 @@ -Subproject commit 4f7ef11c2352dc53539d1ff93887ef637a6c2e2f +Subproject commit 8b24595dbd9ad0a026edf2047b4d1eaceaf09123 diff --git a/limelight-common/ControlStream.c b/limelight-common/ControlStream.c index 931af71..2c80a98 100644 --- a/limelight-common/ControlStream.c +++ b/limelight-common/ControlStream.c @@ -591,19 +591,24 @@ int startControlStream(void) { if (ServerMajorVersion >= 5) { ENetAddress address; 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 - 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) { return -1; } - enet_address_set_host(&address, RemoteAddrString); - enet_address_set_port(&address, 47999); - // Connect to the host peer = enet_host_connect(client, &address, 1, 0); if (peer == NULL) { + enet_host_destroy(client); + client = NULL; return -1; } @@ -611,6 +616,10 @@ int startControlStream(void) { if (enet_host_service(client, &event, CONTROL_STREAM_TIMEOUT_SEC * 1000) <= 0 || event.type != ENET_EVENT_TYPE_CONNECT) { Limelog("RTSP: Failed to connect to UDP port 47999\n"); + enet_peer_reset(peer); + peer = NULL; + enet_host_destroy(client); + client = NULL; return -1; } diff --git a/limelight-common/RtspConnection.c b/limelight-common/RtspConnection.c index ffdaaec..159d7fb 100644 --- a/limelight-common/RtspConnection.c +++ b/limelight-common/RtspConnection.c @@ -452,15 +452,18 @@ int performRtspHandshake(void) { ENetAddress address; 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 - 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) { return -1; } - enet_address_set_host(&address, RemoteAddrString); - enet_address_set_port(&address, 48010); - // Connect to the host peer = enet_host_connect(client, &address, 1, 0); if (peer == NULL) {