summaryrefslogtreecommitdiffstats
path: root/src/server/server.c
diff options
context:
space:
mode:
authorSimon Rettberg2024-07-05 10:48:29 +0200
committerSimon Rettberg2024-07-05 10:48:29 +0200
commitae91f373cf5ce045fe65df022fae151fe915c6c3 (patch)
treec6b069316052f507a52786841054b1afb6d51e4f /src/server/server.c
parent[SERVER] integrity: Add comments, line wraps, add check for full scan (diff)
downloaddnbd3-ae91f373cf5ce045fe65df022fae151fe915c6c3.tar.gz
dnbd3-ae91f373cf5ce045fe65df022fae151fe915c6c3.tar.xz
dnbd3-ae91f373cf5ce045fe65df022fae151fe915c6c3.zip
[SERVER] Verify checksums of all images on SIGUSR1HEADmaster
Diffstat (limited to 'src/server/server.c')
-rw-r--r--src/server/server.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/server.c b/src/server/server.c
index 0f75935..d086930 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -75,7 +75,7 @@ static poll_list_t *listeners = NULL;
* Time the server was started
*/
static ticks startupTime;
-static bool sigReload = false, sigLogCycle = false;
+static bool sigReload = false, sigLogCycle = false, sigHashAll = false;
/**
* Copied to in signal handler so we can print info
@@ -445,6 +445,11 @@ int main(int argc, char *argv[])
else
logadd( LOG_WARNING, "Could not cycle log file." );
}
+ if ( sigHashAll ) {
+ sigHashAll = false;
+ logadd( LOG_INFO, "SIGUSR1 received, verifying checksum of all images..." );
+ image_hashAllImages();
+ }
//
len = sizeof(client);
fd = sock_accept( listeners, &client, &len );
@@ -543,8 +548,10 @@ static void dnbd3_handleSignal(int signum)
if ( _shutdown ) return;
if ( signum == SIGINT || signum == SIGTERM ) {
_shutdown = true;
- } else if ( signum == SIGUSR1 || signum == SIGHUP ) {
+ } else if ( signum == SIGHUP ) {
sigReload = true;
+ } else if ( signum == SIGUSR1 ) {
+ sigHashAll = true;
} else if ( signum == SIGUSR2 ) {
sigLogCycle = true;
}