From: Date: Mon, 21 Apr 2008 19:02:17 +0000 (-0700) Subject: Fixed timeout to be low for connect() X-Git-Tag: _20~1^2~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7921f686e01414a276be4ee8224a0a1ce94694db;p=m6w6%2Flibmemcached Fixed timeout to be low for connect() Updated THANKS file. --- diff --git a/ChangeLog b/ChangeLog index effd1d13..ef18c9fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * Changed default timeout to 1 second for poll timeouts * Wheel uses less memory/dynamic allocation for size (no longer limited to 512 hosts by default. * memslap memory leak fix diff --git a/THANKS b/THANKS index 35db5339..bf6975fa 100644 --- a/THANKS +++ b/THANKS @@ -9,3 +9,4 @@ Kevin Dalley - Bug Fixes Patrick Galbraith - work on C++ interface Ross McFarland - Idea for sorting servers. Marcelo Fernandez - TCP/IP timeout pieces +Yin Chen - Ketama support diff --git a/libmemcached/memcached_connect.c b/libmemcached/memcached_connect.c index 5531ad79..74469870 100644 --- a/libmemcached/memcached_connect.c +++ b/libmemcached/memcached_connect.c @@ -207,7 +207,11 @@ test_connect: fds[0].events= POLLOUT | POLLERR; error= poll(fds, 1, ptr->root->connect_timeout); - if (error != 1) + if (error == 0) + { + goto handle_retry; + } + else if (error != 1) { ptr->cached_errno= errno; WATCHPOINT_ERRNO(ptr->cached_errno); @@ -225,6 +229,7 @@ test_connect: case EISCONN: /* We were spinning waiting on connect */ break; default: +handle_retry: ptr->cached_errno= errno; WATCHPOINT_ERRNO(ptr->cached_errno); close(ptr->fd); diff --git a/libmemcached/memcached_constants.h b/libmemcached/memcached_constants.h index 1d2b08ad..cb7b2095 100644 --- a/libmemcached/memcached_constants.h +++ b/libmemcached/memcached_constants.h @@ -22,7 +22,7 @@ extern "C" { #define MEMCACHED_POINTS_PER_SERVER 100 #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */ #define MEMCACHED_STRIDE 4 -#define MEMCACHED_DEFAULT_TIMEOUT INT32_MAX +#define MEMCACHED_DEFAULT_TIMEOUT 1000 #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */ typedef enum {