Simplify IO code.
[m6w6/libmemcached] / libmemcached / purge.cc
index 86e379e493dfef6930e4e3f716b65c1c8c1ba9bc..6142e5fbf01095a35bf45cf1642292e8989a0d74 100644 (file)
@@ -78,7 +78,6 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
   {
     memcached_result_st result;
     memcached_result_st *result_ptr;
-    char buffer[SMALL_STRING_LEN];
 
     /*
      * We need to increase the timeout, because we might be waiting for
@@ -94,9 +93,7 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
     for (uint32_t x= 0; x < no_msg; x++)
     {
       memcached_result_reset(result_ptr);
-      memcached_return_t rc= memcached_read_one_response(ptr, buffer,
-                                                         sizeof (buffer),
-                                                         result_ptr);
+      memcached_return_t rc= memcached_read_one_response(ptr, result_ptr);
       /*
        * Purge doesn't care for what kind of command results that is received.
        * The only kind of errors I care about if is I'm out of sync with the
@@ -105,20 +102,21 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
       if (rc== MEMCACHED_PROTOCOL_ERROR or rc == MEMCACHED_UNKNOWN_READ_FAILURE or rc == MEMCACHED_READ_FAILURE)
       {
         WATCHPOINT_ERROR(rc);
-        ret= rc;
         memcached_io_reset(ptr);
-        memcached_set_error(*ptr, rc, MEMCACHED_AT);
+        ret= rc;
+#if 0
+        ret= memcached_set_error(*ptr, rc, MEMCACHED_AT);
+#endif
       }
 
       if (ptr->root->callbacks != NULL)
       {
         memcached_callback_st cb = *ptr->root->callbacks;
-        if (rc == MEMCACHED_SUCCESS)
+        if (memcached_success(rc))
         {
           for (uint32_t y= 0; y < cb.number_of_callback; y++)
           {
-            rc = (*cb.callback[y])(ptr->root, result_ptr, cb.context);
-            if (rc != MEMCACHED_SUCCESS)
+            if (memcached_fatal((*cb.callback[y])(ptr->root, result_ptr, cb.context)))
             {
               break;
             }