summaryrefslogtreecommitdiffstats
path: root/src/server/integrity.c
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-13 16:51:16 +0200
committerSimon Rettberg2013-08-13 16:51:16 +0200
commit4249a20d130262bc9b5e562fc73b712ce072b0b7 (patch)
tree30196f25d131d90ba25ed85db4decb8bd86a4c60 /src/server/integrity.c
parentI'm stupid (diff)
downloaddnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.tar.gz
dnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.tar.xz
dnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.zip
[SERVER] Fix race condition in uplink request aggregation, other small improvements and debugging features
Diffstat (limited to 'src/server/integrity.c')
-rw-r--r--src/server/integrity.c4
1 files changed, 3 insertions, 1 deletions
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) {