diff options
author | Simon Rettberg | 2015-12-15 18:05:46 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-12-15 18:05:46 +0100 |
commit | b4cf06abaa5278b016c2036b6574d1be129f3d99 (patch) | |
tree | 29c374968e6bc03784199f2bb1faba611660f1c3 | |
parent | [SERVER] Remove non-working images from list, plus refactoring (diff) | |
download | dnbd3-b4cf06abaa5278b016c2036b6574d1be129f3d99.tar.gz dnbd3-b4cf06abaa5278b016c2036b6574d1be129f3d99.tar.xz dnbd3-b4cf06abaa5278b016c2036b6574d1be129f3d99.zip |
[SERVER] Update config example
-rw-r--r-- | server.config.example/server.conf | 4 | ||||
-rw-r--r-- | src/server/image.c | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/server.config.example/server.conf b/server.config.example/server.conf index 8ac942d..7ef10a3 100644 --- a/server.config.example/server.conf +++ b/server.config.example/server.conf @@ -1,4 +1,6 @@ [dnbd3] +; port to listen on (default: 5003) +listenPort=5003 ; relative root directory for images, ending in .r[1-9][0-9]* basePath=/mnt/storage/dnbd3 ; artificial connection delay for connecting servers @@ -9,6 +11,8 @@ clientPenalty=0 isProxy=true ; if proxy is true and an image is incomplete, should idle bandwidth be used to replicate missing blocks? backgroundReplication=true +; if true (which is the default), images will automatically be removed from the list if they can't be accessed +removeMissingImages=true ; timeout in ms for send/recv on connections to uplink servers (used for replication) uplinkTimeout=1250 ; timeout in ms for send/recv on connections to clients (using an image on this server) diff --git a/src/server/image.c b/src/server/image.c index d4df26d..2a48047 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -324,7 +324,9 @@ dnbd3_image_t* image_get(char *name, uint16_t revision, bool checkIfWorking) const off_t len = lseek( candidate->readFd, 0, SEEK_END ); if ( len == -1 ) { logadd( LOG_WARNING, "lseek() on %s failed (errno=%d), removing image", candidate->path, errno ); - image_remove( candidate ); // No release here, the image is still returned and should be released by caller + if ( _removeMissingImages ) { + image_remove( candidate ); // No release here, the image is still returned and should be released by caller + } } else if ( (uint64_t)len != candidate->realFilesize ) { logadd( LOG_DEBUG1, "Size of %s changed at runtime, keeping disabled! Expected: %" PRIu64 ", found: %" PRIu64 ". Try sending SIGHUP to server if you know what you're doing.", @@ -335,7 +337,9 @@ dnbd3_image_t* image_get(char *name, uint16_t revision, bool checkIfWorking) if ( pread( candidate->readFd, buffer, sizeof(buffer), 0 ) == -1 ) { logadd( LOG_DEBUG2, "Reading first %d bytes from %s failed (errno=%d), removing image", (int)sizeof(buffer), candidate->path, errno ); - image_remove( candidate ); + if ( _removeMissingImages ) { + image_remove( candidate ); + } } else { // Seems everything is fine again \o/ candidate->working = true; |