First pass through turning instance into ++
[m6w6/libmemcached] / libmemcached / do.cc
index ed66028c3eb2b5458e60adce77ef69630a918e6b..0d05ea6d4523675a6d89e0987e2ccd44b6b6c837 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <libmemcached/common.h>
 
-memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
+memcached_return_t memcached_vdo(org::libmemcached::Instance* instance,
                                  libmemcached_io_vector_st vector[],
                                  const size_t count,
                                  const bool with_flush)
@@ -23,7 +23,7 @@ memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
   if (memcached_failed(rc= memcached_connect(instance)))
   {
     WATCHPOINT_ERROR(rc);
-    assert_msg(instance->error_messages, "memcached_connect() returned an error but the memcached_server_write_instance_st showed none.");
+    assert_msg(instance->error_messages, "memcached_connect() returned an error but the Instance showed none.");
     return rc;
   }
 
@@ -65,7 +65,6 @@ memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
           return memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
         }
 
-        perror(__func__);
         return memcached_set_errno(*instance, errno, MEMCACHED_AT);
       }
     }
@@ -73,18 +72,17 @@ memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
     return MEMCACHED_SUCCESS;
   }
 
-  ssize_t sent_length= memcached_io_writev(instance, vector, count, with_flush);
-  size_t command_length= 0;
-  for (uint32_t x= 0; x < count; ++x, vector++)
+  bool sent_success= memcached_io_writev(instance, vector, count, with_flush);
+  if (sent_success == false)
   {
-    command_length+= vector->length;
-  }
-
-  if (sent_length == -1 or size_t(sent_length) != command_length)
-  {
-    rc= MEMCACHED_WRITE_FAILURE;
-    WATCHPOINT_ERROR(rc);
-    WATCHPOINT_ERRNO(errno);
+    if (memcached_last_error(instance->root) == MEMCACHED_SUCCESS)
+    {
+      return memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
+    }
+    else
+    {
+      rc= MEMCACHED_WRITE_FAILURE;
+    }
   }
   else if (memcached_is_replying(instance->root))
   {