Improve ENet socket error propagation for better debuggability

This commit is contained in:
Cameron Gutman
2023-12-22 13:45:50 -06:00
parent 3ed3ba6253
commit 3aae4cdc59
3 changed files with 13 additions and 4 deletions

View File

@@ -144,7 +144,7 @@ static bool transactRtspMessageEnet(PRTSP_MESSAGE request, PRTSP_MESSAGE respons
// Wait for a reply
if (serviceEnetHost(client, &event, RTSP_RECEIVE_TIMEOUT_SEC * 1000) <= 0 ||
event.type != ENET_EVENT_TYPE_RECEIVE) {
Limelog("Failed to receive RTSP reply\n");
Limelog("Failed to receive RTSP reply: %d\n", LastSocketFail());
goto Exit;
}
@@ -165,7 +165,7 @@ static bool transactRtspMessageEnet(PRTSP_MESSAGE request, PRTSP_MESSAGE respons
// The payload comes in a second packet
if (serviceEnetHost(client, &event, RTSP_RECEIVE_TIMEOUT_SEC * 1000) <= 0 ||
event.type != ENET_EVENT_TYPE_RECEIVE) {
Limelog("Failed to receive RTSP reply payload\n");
Limelog("Failed to receive RTSP reply payload: %d\n", LastSocketFail());
goto Exit;
}
@@ -851,7 +851,7 @@ int performRtspHandshake(PSERVER_INFORMATION serverInfo) {
// Wait for the connect to complete
if (serviceEnetHost(client, &event, RTSP_CONNECT_TIMEOUT_SEC * 1000) <= 0 ||
event.type != ENET_EVENT_TYPE_CONNECT) {
Limelog("RTSP: Failed to connect to UDP port %u\n", RtspPortNumber);
Limelog("RTSP: Failed to connect to UDP port %u: error %d\n", RtspPortNumber, LastSocketFail());
enet_peer_reset(peer);
peer = NULL;
enet_host_destroy(client);