From ec7b7475abfcbdae49e244f6afee37c49326dbf0 Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Wed, 13 Mar 2013 12:15:34 -0700 Subject: [PATCH] fixed time capsule mount timeout Set the volume_open timeout to 20 seconds to allow an idle time capsule disk to spin up. --- Bugs.txt | 3 --- cmdline/cmdline_afp.c | 2 +- include/afpfs-ng/dsi.h | 3 +++ lib/did.c | 6 +++--- lib/proto_volume.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Bugs.txt b/Bugs.txt index d4903e8..7bf46d5 100644 --- a/Bugs.txt +++ b/Bugs.txt @@ -3,9 +3,6 @@ These are known bugs in afpfs-ng 0.8: - this code definitely needs more testing... -- mounting a time capsule can result in a timeout while the disk starts spinning. - (mine takes more than 10 seconds to spin up). Retrying right after always succeeds. - - if afpfsd isnt' running, and you run an 'afp_client exit', it restarts it and then kills it diff --git a/cmdline/cmdline_afp.c b/cmdline/cmdline_afp.c index 681ee88..5d9de6b 100644 --- a/cmdline/cmdline_afp.c +++ b/cmdline/cmdline_afp.c @@ -1217,7 +1217,7 @@ int cmdline_afp_setup(int recursive, char * url_string) { struct passwd * passwd; - snprintf(curdir,sizeof(curdir), DEFAULT_DIRECTORY); + snprintf(curdir, sizeof(curdir), DEFAULT_DIRECTORY); if (init_uams()<0) return -1; afp_default_url(&url); diff --git a/include/afpfs-ng/dsi.h b/include/afpfs-ng/dsi.h index 8428431..a162842 100644 --- a/include/afpfs-ng/dsi.h +++ b/include/afpfs-ng/dsi.h @@ -30,6 +30,9 @@ int dsi_recv(struct afp_server * server); #define DSI_BLOCK_TIMEOUT -1 #define DSI_DONT_WAIT 0 #define DSI_DEFAULT_TIMEOUT 5 +//a spun down time capsule can take up to 20 secs to +//wake up and reply to a mount request +#define DSI_OPENVOLUME_TIMEOUT 20 #endif diff --git a/lib/did.c b/lib/did.c index 882d18c..b391e66 100644 --- a/lib/did.c +++ b/lib/did.c @@ -17,9 +17,9 @@ static unsigned short timeout=10; struct did_cache_entry { - /* For the example /foo/bar/baz */ - char dirname[AFP_MAX_PATH]; /* full name, eg. /foo/bar/ */ - unsigned int did; /* eg 2323 */ + /* For the example /foo/bar/baz */ + char dirname[AFP_MAX_PATH]; /* full name, eg. /foo/bar/ */ + unsigned int did; /* eg 2323 */ struct timeval time; struct did_cache_entry * next; } ; diff --git a/lib/proto_volume.c b/lib/proto_volume.c index 605b7d2..9645ceb 100644 --- a/lib/proto_volume.c +++ b/lib/proto_volume.c @@ -184,7 +184,7 @@ int afp_volopen(struct afp_volume * volume, } ret=dsi_send(volume->server, (char *) msg,len, - DSI_DEFAULT_TIMEOUT,afpOpenVol,(void *) &volume); + DSI_OPENVOLUME_TIMEOUT,afpOpenVol,(void *) &volume); free(msg); return ret;