From 4249a20d130262bc9b5e562fc73b712ce072b0b7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 13 Aug 2013 16:51:16 +0200 Subject: [SERVER] Fix race condition in uplink request aggregation, other small improvements and debugging features --- src/server/integrity.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/server/integrity.c') diff --git a/src/server/integrity.c b/src/server/integrity.c index 875b62d..400e171 100644 --- a/src/server/integrity.c +++ b/src/server/integrity.c @@ -38,7 +38,9 @@ void integrity_init() assert( queueLen == -1 ); pthread_mutex_init( &integrityQueueLock, NULL ); pthread_cond_init( &queueSignal, NULL ); + bRunning = TRUE; if ( 0 != pthread_create( &thread, NULL, &integrity_main, (void *)NULL ) ) { + bRunning = FALSE; memlogf( "[WARNING] Could not start integrity check thread. Corrupted images will not be detected." ); return; } @@ -96,10 +98,10 @@ void integrity_check(dnbd3_image_t *image, int block) static void* integrity_main(void *data) { - bRunning = TRUE; int i; uint8_t *buffer = NULL; size_t bufferSize = 0; + setThreadName( "image-check" ); pthread_mutex_lock( &integrityQueueLock ); while ( !_shutdown ) { for (i = queueLen - 1; i >= 0; --i) { -- cgit v1.2.3-55-g7522