summaryrefslogtreecommitdiffstats
path: root/src/server/image.c
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-02 18:13:24 +0200
committerSimon Rettberg2013-08-02 18:13:24 +0200
commit762f7a4d7b3155254416b460c28a23c418ae59ed (patch)
treefb904393252a9f5688d2327c8c04965edf6c505b /src/server/image.c
parentfix0rs (diff)
downloaddnbd3-762f7a4d7b3155254416b460c28a23c418ae59ed.tar.gz
dnbd3-762f7a4d7b3155254416b460c28a23c418ae59ed.tar.xz
dnbd3-762f7a4d7b3155254416b460c28a23c418ae59ed.zip
[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
Diffstat (limited to 'src/server/image.c')
-rw-r--r--src/server/image.c4
1 files changed, 2 insertions, 2 deletions
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!
}