Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS flag (you can now avoid multiple DNS
[m6w6/libmemcached] / lib / memcached_stats.c
index e90f1c0f1a1921902a17f659395d97fd6573d636..a2dc17a3e0e56fc0a444893c103fa673b3eb996e 100644 (file)
@@ -152,9 +152,6 @@ char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *stat,
   char buffer[SMALL_STRING_LEN];
   *error= MEMCACHED_SUCCESS;
 
-
-  memset(buffer, 0, SMALL_STRING_LEN);
-
   if (!memcmp("pid", key, strlen("pid")))
     snprintf(buffer, SMALL_STRING_LEN,"%u", stat->pid);
   else if (!memcmp("uptime", key, strlen("uptime")))
@@ -223,7 +220,7 @@ static memcached_return memcached_stats_fetch(memcached_st *ptr,
 {
   memcached_return rc;
   char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
-  size_t send_length, sent_length;
+  size_t send_length;
 
   rc= memcached_connect(ptr, server_key);
 
@@ -240,10 +237,9 @@ static memcached_return memcached_stats_fetch(memcached_st *ptr,
   if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
     return MEMCACHED_WRITE_FAILURE;
 
-  sent_length= memcached_io_write(ptr, server_key, buffer, send_length, 1);
-
-  if (sent_length == -1 || sent_length != send_length)
-    return MEMCACHED_WRITE_FAILURE;
+  rc= memcached_do(ptr, server_key, buffer, send_length, 1);
+  if (rc != MEMCACHED_SUCCESS)
+      goto error;
 
   while (1)
   {
@@ -271,6 +267,7 @@ static memcached_return memcached_stats_fetch(memcached_st *ptr,
       break;
   }
 
+error:
   if (rc == MEMCACHED_END)
     return MEMCACHED_SUCCESS;
   else