memcap works, though it does nothing useful at the moment :)
[m6w6/libmemcached] / lib / memcached_verbosity.c
index bb4f68c06ecd13c2fd1ada0681a0b743fdb1a0c7..0be5fd4bb6501cc38fa22186fed57a9126619ab3 100644 (file)
@@ -1,4 +1,4 @@
-#include <memcached.h>
+#include "common.h"
 
 memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity)
 {
@@ -14,16 +14,17 @@ memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity)
 
   send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
                         "verbosity %u\r\n", verbosity);
+  if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+    return MEMCACHED_WRITE_FAILURE;
 
   for (x= 0; x < ptr->number_of_hosts; x++)
   {
     memcached_return rc;
 
-    if ((write(ptr->hosts[x].fd, buffer, send_length) == -1))
+    if ((send(ptr->hosts[x].fd, buffer, send_length, 0) == -1))
     {
-      fprintf(stderr, "failed verbosity\n");
-
-      return MEMCACHED_WRITE_FAILURE;
+      continue;
+      return MEMCACHED_SOME_ERRORS;
     }
 
     rc= memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, x);