From 68621e26da1196e688961ac43eeb072f18696662 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 5 May 2023 15:40:06 +0200 Subject: [PATCH] server: minimum SS_CONNECTED --- kernel/mars_server.c | 7 +++++++ kernel/mars_server.h | 1 + 2 files changed, 8 insertions(+) diff --git a/kernel/mars_server.c b/kernel/mars_server.c index 9f15f64e..b1e567c9 100644 --- a/kernel/mars_server.c +++ b/kernel/mars_server.c @@ -1067,6 +1067,13 @@ void check_bricks(void) continue; brick_yield(); 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); /* only once per round */ break; diff --git a/kernel/mars_server.h b/kernel/mars_server.h index 0bff6cbe..8f06a992 100644 --- a/kernel/mars_server.h +++ b/kernel/mars_server.h @@ -62,6 +62,7 @@ struct server_brick { struct task_struct *handler_thread; struct task_struct *cb_thread; void *delegated_brick; + unsigned long shutdown_jiffies; wait_queue_head_t startup_event; wait_queue_head_t cb_event; struct mutex cb_mutex;