Fixed test case output
[m6w6/libmemcached] / lib / memcached_get.c
index 4d2b10d2edad397ae2efd18bba7a25d1a81b9bed..201cfcdf82d62b9661f838fa7e2fba70e9422573 100644 (file)
@@ -34,10 +34,13 @@ static char *memcached_value_fetch(memcached_st *ptr, char *key, size_t *key_len
     if (load_key)
     {
       memset(key, 0, MEMCACHED_MAX_KEY);
+      *key_length= 0;
+
       for (; end_ptr == string_ptr || *string_ptr != ' '; string_ptr++)
       {
         *key= *string_ptr;
         key++;
+        (*key_length)++;
       }
     }
     else /* Skip characters */
@@ -137,7 +140,8 @@ char *memcached_get(memcached_st *ptr, char *key, size_t key_length,
 
   send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, "get %.*s\r\n", 
                         (int)key_length, key);
-  if ((send(ptr->hosts[server_key].fd, buffer, send_length, 0) == -1))
+
+  if ((memcached_io_write(ptr, server_key, buffer, send_length, 1)) == -1)
   {
     *error= MEMCACHED_WRITE_FAILURE;
     goto error;
@@ -239,8 +243,8 @@ memcached_return memcached_mget(memcached_st *ptr,
       memcached_string_st *string= cursor_key_exec[x];
       memcached_string_append(ptr, string, "\r\n", 2);
 
-      if ((send(ptr->hosts[x].fd, string->string, 
-                 memcached_string_length(ptr, string), 0) == -1))
+      if ((memcached_io_write(ptr, x, string->string, 
+                              memcached_string_length(ptr, string), 1)) == -1)
       {
         memcached_quit(ptr);
         rc= MEMCACHED_SOME_ERRORS;