server: minimum SS_CONNECTED

This commit is contained in:
Thomas Schoebel-Theuer 2023-05-05 15:40:06 +02:00
parent 0856f56918
commit 68621e26da
2 changed files with 8 additions and 0 deletions

View File

@ -1067,6 +1067,13 @@ void check_bricks(void)
continue; continue;
brick_yield(); brick_yield();
if (mars_socket_is_alive(handler_socket)) { if (mars_socket_is_alive(handler_socket)) {
if (!running_brick->shutdown_jiffies) {
running_brick->shutdown_jiffies = jiffies;
continue;
}
/* Minimum connection duration, for better sysadmin detection */
if (running_brick->shutdown_jiffies + 3 * HZ <= jiffies)
continue;
mars_shutdown_socket(handler_socket); mars_shutdown_socket(handler_socket);
/* only once per round */ /* only once per round */
break; break;

View File

@ -62,6 +62,7 @@ struct server_brick {
struct task_struct *handler_thread; struct task_struct *handler_thread;
struct task_struct *cb_thread; struct task_struct *cb_thread;
void *delegated_brick; void *delegated_brick;
unsigned long shutdown_jiffies;
wait_queue_head_t startup_event; wait_queue_head_t startup_event;
wait_queue_head_t cb_event; wait_queue_head_t cb_event;
struct mutex cb_mutex; struct mutex cb_mutex;