From dad3eb914c5442174be36d7ba4c439ceec1e5c8a Mon Sep 17 00:00:00 2001 From: alrod999 Date: Sun, 26 Feb 2023 12:41:39 +0200 Subject: [PATCH] Prevent abnormal exit when connection failed Currently, sipp exits abnormally if a TCP/TLS connection to the UAS is refused. This can also occur in multi-socket mode (tn/ln), where some users might prefer to ignore the error and keep running. I propose linking this behavior to the -reconnect_close option (the default behavior remains unchanged). --- src/call.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index c2e3595f..2e90510c 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -1624,7 +1624,7 @@ char * call::send_scene(int index, int *send_status, int *len) /* Socket port must be known before string substitution */ if (!connect_socket_if_needed()) { - *send_status = -2; + *send_status = -3; return nullptr; } @@ -1944,10 +1944,16 @@ bool call::executeMessage(message *curmsg) } msg_snd = send_scene(msg_index, &send_status, &msgLen); - if (!msg_snd) { + if (send_status == -3) { /* This will hit connect_if_needed, and if it fails, the entire call is deleted... */ - ERROR("Call failed, cannot continue safely..."); + if (reset_close) { + ERROR("Call failed due to a connection problem, terminate execution... " + "(use '-reconnect_close false' option to ignore)"); + } else { + WARNING("Call failed due to a connection problem and abnormally terminated"); + return false; + } } if(send_status < 0 && errno == EWOULDBLOCK) {