Skip to content
Snippets Groups Projects
Commit 0ac5ed57 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Set node "interrupt" flag to try to gracefully disconnect user blocking event

When a timed event is configured to run "exclusively", all nodes need to not be
in in-use. As it was, after waiting 60 minutes for the online user(s) to
notice they'd run out of time and disconnect, we'd just (rather ungracefully)
close the sockets used by such node(s) connections. This results in same logged
errors about trying to send to bad socket descriptors and provides no feedback
to the user about why they were disconnected.

Since we have the node interrupt flag (which hopefully, all scripts are
checking via node_sync) - use that to try to more gracefully terminate the
user's session/connection after 30 minutes of waiting for the user to
disconnect.

If after 60 minutes of waiting, the node is still in-use, we still do the
socket disconnection method.
parent 6a0971f6
No related branches found
No related tags found
No related merge requests found
...@@ -3385,17 +3385,24 @@ void event_thread(void* arg) ...@@ -3385,17 +3385,24 @@ void event_thread(void* arg)
} }
if (j > sbbs->cfg.sys_nodes) /* all nodes either offline or in limbo */ if (j > sbbs->cfg.sys_nodes) /* all nodes either offline or in limbo */
break; break;
sbbs->lprintf(LOG_DEBUG, "Waiting for node %d (status=%d)" char node_status[128];
, j, node.status); snprintf(node_status, sizeof node_status, "status=%d, misc=0x%X, action=%d, useron=%d, aux=%d"
, node.status, node.misc, node.action, node.useron, node.aux);
sbbs->lprintf(LOG_DEBUG, "Waiting for node %d (%s)", j, node_status);
if (now - start > (30 * 60) && !(node.misc & NODE_INTR)) {
sbbs->lprintf(LOG_NOTICE, "!Interrupting node %d (%s)", j, node_status);
if (!set_node_interrupt(&sbbs->cfg, j, true))
sbbs->lprintf(LOG_ERR, "!ERROR interrupting node %d (%s)", j, node_status);
}
if (now - start > (60 * 60) && node_socket[j - 1] != INVALID_SOCKET) { if (now - start > (60 * 60) && node_socket[j - 1] != INVALID_SOCKET) {
sbbs->lprintf(LOG_WARNING, "!TIRED of waiting for node %d to become inactive (status=%d), closing socket %d" sbbs->lprintf(LOG_WARNING, "!TIRED of waiting for node %d to become inactive (%s), closing socket %d"
, j, node.status, node_socket[j - 1]); , j, node_status, node_socket[j - 1]);
close_socket(node_socket[j - 1]); close_socket(node_socket[j - 1]);
node_socket[j - 1] = INVALID_SOCKET; node_socket[j - 1] = INVALID_SOCKET;
} }
if (now - start > (90 * 60)) { if (now - start > (90 * 60)) {
sbbs->lprintf(LOG_WARNING, "!TIMEOUT waiting for node %d to become inactive (status=%d), aborting wait" sbbs->lprintf(LOG_WARNING, "!TIMEOUT waiting for node %d to become inactive (%s), aborting wait"
, j, node.status); , j, node_status);
break; break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment