Partial work on making UDP protocol actually work (flush_all working!)
[m6w6/libmemcached] / lib / memcached_do.c
index 5fcfe8325b7565bf858356225324a1cd49f55917..c4bf574f641d8a28d36ce649db884bc20d913c74 100644 (file)
@@ -1,22 +1,23 @@
 #include "common.h"
 
-memcached_return memcached_do(memcached_st *ptr, unsigned int server_key, char *command, 
-                              size_t command_length, char with_flush)
+memcached_return memcached_do(memcached_server_st *ptr, char *command, 
+                              size_t command_length, uint8_t with_flush)
 {
   memcached_return rc;
   ssize_t sent_length;
 
+  WATCHPOINT_ASSERT(command_length);
   WATCHPOINT_ASSERT(command);
-  if ((rc= memcached_connect(ptr, server_key)) != MEMCACHED_SUCCESS)
+
+  if ((rc= memcached_connect(ptr)) != MEMCACHED_SUCCESS)
     return rc;
 
-  sent_length= memcached_io_write(ptr, server_key, command, command_length, with_flush);
+  sent_length= memcached_io_write(ptr, command, command_length, with_flush);
 
   if (sent_length == -1 || sent_length != command_length)
-  {
-    memcached_quit_server(ptr, server_key);
     rc= MEMCACHED_WRITE_FAILURE;
-  }
+  else
+    memcached_server_response_increment(ptr);
 
   return rc;
 }