Open RandyLevensalor opened 12 years ago
From 7e9c0e32912ececc3a9cde5f0f11465f2ec9a2dd Mon Sep 17 00:00:00 2001 From: Randy Levensalor randy.levensalor@gmail.com Date: Sat, 3 Mar 2012 11:17:02 -0700 Subject: [PATCH] Committer: Randy Levensalor randy.levensalor@gmail.com
On branch add_connect_timeout Changes to be committed: modified: cloudfsapi.c modified: cloudfsapi.h
cloudfsapi.c | 12 +++++++++--- cloudfsapi.h | 1 + cloudfuse.c | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/cloudfsapi.c b/cloudfsapi.c index ba14035..bd136b4 100644 --- a/cloudfsapi.c +++ b/cloudfsapi.c @@ -24,6 +24,7 @@ static pthread_mutex_t pool_mut; static CURL *curl_pool[1024]; static int curl_pool_count = 0; static int debug = 0; +static int connect_timeout = 10;
@@ -104,7 +105,7 @@ static CURL get_connection(const char path) curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
@@ -354,6 +355,11 @@ int create_directory(const char *path) return (response >= 200 && response < 300); }
+void cloudfs_connect_timeout(int conn_timeout) +{
diff --git a/cloudfuse.c b/cloudfuse.c index bf7e195..84854c5 100644 --- a/cloudfuse.c +++ b/cloudfuse.c @@ -21,6 +21,7 @@
static int cache_timeout; +static int connect_timeout;
typedef struct dir_cache { @@ -423,12 +424,14 @@ static struct options { char cache_timeout[OPTION_SIZE]; char authurl[OPTION_SIZE]; char use_snet[OPTION_SIZE];
.connect_timeout = "10", };
int parse_option(void data, const char arg, int key, struct fuse_args outargs) @@ -437,7 +440,8 @@ int parse_option(void data, const char arg, int key, struct fuse_args outargs sscanf(arg, " api_key = %[^\r\n ]", options.api_key) || sscanf(arg, " cache_timeout = %[^\r\n ]", options.cache_timeout) || sscanf(arg, " authurl = %[^\r\n ]", options.authurl) ||
sscanf(arg, " connect_timeout = %[^\r\n ]", options.connect_timeout))
return 0; if (!strcmp(arg, "-f") || !strcmp(arg, "-d") || !strcmp(arg, "debug")) cloudfs_debug(1); @@ -462,7 +466,8 @@ int main(int argc, char **argv) }
1.7.5.4
When running cloudefuse I would receive a "Unable to authenticate." error. Using the same authentication url and credentials, I was able to authenticate.
The root cause is that my connection was timing out. Please increase the default or add an option to set the timeout.
I will post a patch that adds a connect_timeout option.