Branch merge for fixes in reconnect.
author <brian@gir-2.local> <>
Fri, 29 Feb 2008 07:22:14 +0000 (23:22 -0800)
committer <brian@gir-2.local> <>
Fri, 29 Feb 2008 07:22:14 +0000 (23:22 -0800)
ChangeLog
THANKS
include/memcached.h
lib/memcached_connect.c
lib/memcached_storage.c
src/utilities.c

index f3cd040bfd5dc30d01b217a02b8f0bd600bfa32d..3a9e3afa546f70d09323267cb462d89b464ac58a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,12 @@
   * Replication support has been added to the library.
 
-0.17
+0.17 Wed Feb 27 03:33:29 PST 2008
   * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in
     non-block mode.
   * Incompatible change in memcached_behavior_set() api. We now use a
     uint64_t, instead of a pointer.
+  * Fix for storage of values for zero.
+  * memcached_server_cursor() function added to API for cycling through servers.
 
 0.16 Mon Feb 18 00:30:25 PST 2008
   * Work on the UDP protocol
diff --git a/THANKS b/THANKS
index 45809cec22285ddc2682a4039559295c7c1885cb..35db53395a547f464936e9f82d03207069a054ab 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -8,3 +8,4 @@ Tim Bunce - Perl Driver work and feedback on API
 Kevin Dalley - Bug Fixes
 Patrick Galbraith - work on C++ interface
 Ross McFarland - Idea for sorting servers.
+Marcelo Fernandez - TCP/IP timeout pieces
index 4a283ec6c83c8937bf22860054263cfad94216a2..1c80878dec9b2e2fdfe2f6e75c6067870af92d70 100644 (file)
@@ -264,7 +264,7 @@ memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity);
 void memcached_quit(memcached_st *ptr);
 char *memcached_strerror(memcached_st *ptr, memcached_return rc);
 memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data);
-unsigned long long memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
+uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
 
 /* All of the functions for adding data to the server */
 memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_length, 
index 9d935e024cb0fbe22ae36b93b5c99be771bbc932..1b4a5fd5839a22373549f29d68c15634eb68b90b 100644 (file)
@@ -1,4 +1,5 @@
 #include "common.h"
+#include <poll.h>
 
 static memcached_return set_hostinfo(memcached_server_st *server)
 {
@@ -136,47 +137,6 @@ test_connect:
     {
       switch (errno) {
       case EINPROGRESS:
-        {
-        struct timeval tm = { ptr->root->connect_timeout, 0 };
-        socklen_t len= sizeof(int);
-        fd_set wset;
-        int error=0, value;
-
-        FD_ZERO(&wset);
-        FD_SET(ptr->fd, &wset);
-
-        select(ptr->fd+1, NULL, &wset, NULL, &tm);
-        if (FD_ISSET(ptr->fd, &wset) != 0)
-        {
-          if (getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &value, &len) == 0)
-          {
-            if (value)
-            {
-              error= 1;
-            }
-          }
-          else
-          {
-            error= 1;
-          }
-        }
-        else
-        {
-          error= 1;
-        }
-
-        if (error)
-        {
-          ptr->cached_errno= errno;
-          WATCHPOINT_ERRNO(ptr->cached_errno);
-          close(ptr->fd);
-          ptr->fd= -1;
-          return MEMCACHED_ERRNO;
-        }
-
-        break;
-        }
-        /* We are spinning waiting on connect */
       case EALREADY:
       case EINTR:
         goto test_connect;
@@ -237,6 +197,27 @@ test_connect:
           /* We are spinning waiting on connect */
         case EALREADY:
         case EINPROGRESS:
+          {
+            struct pollfd fds[1];
+            int error;
+
+            memset(&fds, 0, sizeof(struct pollfd));
+            fds[0].fd= ptr->fd;
+            fds[0].events= POLLOUT |  POLLERR;
+            error= poll(fds, 1, ptr->root->connect_timeout);
+
+            if (error != 1)
+            {
+              ptr->cached_errno= errno;
+              WATCHPOINT_ERRNO(ptr->cached_errno);
+              close(ptr->fd);
+              ptr->fd= -1;
+              return MEMCACHED_ERRNO;
+            }
+
+            break;
+          }
+        /* We are spinning waiting on connect */
         case EINTR:
           goto test_connect;
         case EISCONN: /* We were spinning waiting on connect */
index 3b1ee242ab087747a5faad00b74281054c4a44ac..2a0f88d493f355df2e862af79dfd1c8d8b2b22af 100644 (file)
@@ -58,9 +58,6 @@ static inline memcached_return memcached_send(memcached_st *ptr,
   unsigned int server_key;
   uint8_t replicas= 0;
 
-  WATCHPOINT_ASSERT(!(value == NULL && value_length > 0));
-  WATCHPOINT_ASSERT(!(value && value_length == 0));
-
   unlikely (key_length == 0)
     return MEMCACHED_NO_KEY_PROVIDED;
 
index 2094d2186e3a14c3d88ac01236cdf192391ef88d..2a63f9e582a9bf01d9570771c960eaa02344ed0a 100644 (file)
@@ -75,7 +75,7 @@ void help_command(char *command_name, char *description,
 
 void process_hash_option(memcached_st *memc, char *opt_hash)
 {
-  unsigned int set;
+  uint64_t set;
   memcached_return rc;
 
   if (opt_hash == NULL)
@@ -99,7 +99,7 @@ void process_hash_option(memcached_st *memc, char *opt_hash)
     exit(1);
   }
 
-  rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &set);
+  rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
   if (rc != MEMCACHED_SUCCESS)
   {
     fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));