redbo / cloudfuse

Filesystem (fuse) implemented on Mosso's Cloud Files
http://redbo.github.com/cloudfuse/
MIT License
392 stars 114 forks source link

Curl timeout is too short for some connections #30

Open RandyLevensalor opened 12 years ago

RandyLevensalor commented 12 years ago

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.

RandyLevensalor commented 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

modified: cloudfuse.c

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;

ifdef HAVE_OPENSSL

include <openssl/crypto.h>

@@ -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 @@

define OPTION_SIZE 1024

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];

1.7.5.4