From 762f7a4d7b3155254416b460c28a23c418ae59ed Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Aug 2013 18:13:24 +0200 Subject: [SERVER] several improvements 1) Close uplink if local copy is complete 2) Fix memleak when closing uplink (recv buffer was not cleared) 3) Add configurable artificial delays for client and server connections --- src/server/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/image.c') diff --git a/src/server/image.c b/src/server/image.c index d4ed5cf..679dd40 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -39,7 +39,7 @@ int image_is_complete(dnbd3_image_t *image) if ( image->working && image->cache_map == NULL ) { return TRUE; } - if ( image->filesize == 0 || !image->working ) { + if ( image->filesize == 0 ) { return FALSE; } int complete = TRUE, j; @@ -175,7 +175,7 @@ dnbd3_image_t* image_get(char *name, uint16_t revision) // Found, see if it works struct stat st; - if ( stat( candidate->path, &st ) < 0 ) { + if ( candidate->working && stat( candidate->path, &st ) < 0 ) { printf( "[DEBUG] File '%s' has gone away...\n", candidate->path ); candidate->working = FALSE; // No file? OUT! } -- cgit v1.2.3-55-g7522