Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent abnormal exit when connection failed #611

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,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 NULL;
}

Expand Down Expand Up @@ -1941,10 +1941,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) {
Expand Down