Fix assert failure on control stream establishment failure

This commit is contained in:
Cameron Gutman 2019-11-02 21:27:35 -07:00
parent 197594f38c
commit dca2205ac8

View File

@ -794,6 +794,7 @@ int startControlStream(void) {
// Create a client that can use 1 outgoing connection and 1 channel
client = enet_host_create(address.address.ss_family, NULL, 1, 1, 0, 0);
if (client == NULL) {
stopping = 1;
return -1;
}
@ -802,6 +803,7 @@ int startControlStream(void) {
// Connect to the host
peer = enet_host_connect(client, &address, 1, 0);
if (peer == NULL) {
stopping = 1;
enet_host_destroy(client);
client = NULL;
return -1;
@ -810,7 +812,8 @@ int startControlStream(void) {
// Wait for the connect to complete
if (serviceEnetHost(client, &event, CONTROL_STREAM_TIMEOUT_SEC * 1000) <= 0 ||
event.type != ENET_EVENT_TYPE_CONNECT) {
Limelog("RTSP: Failed to connect to UDP port 47999\n");
Limelog("Failed to connect to UDP port 47999\n");
stopping = 1;
enet_peer_reset(peer);
peer = NULL;
enet_host_destroy(client);
@ -828,6 +831,7 @@ int startControlStream(void) {
ctlSock = connectTcpSocket(&RemoteAddr, RemoteAddrLen,
47995, CONTROL_STREAM_TIMEOUT_SEC);
if (ctlSock == INVALID_SOCKET) {
stopping = 1;
return LastSocketFail();
}