#include <libmemcached/common.h>
-memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
+bool memcached_purge(memcached_server_write_instance_st ptr)
{
- memcached_return_t ret= MEMCACHED_SUCCESS;
memcached_st *root= (memcached_st *)ptr->root;
if (memcached_is_purging(ptr->root) || /* already purging */
(ptr->io_bytes_sent >= ptr->root->io_bytes_watermark &&
memcached_server_response_count(ptr) < 2))
{
- return MEMCACHED_SUCCESS;
+ return true;
}
/*
{
memcached_set_purging(root, true);
- return memcached_set_error(*ptr, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
+ memcached_set_error(*ptr, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
+ return false;
}
WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET);
+ bool is_successful= true;
uint32_t no_msg= memcached_server_response_count(ptr) - 1;
if (no_msg > 0)
{
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
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
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);
+ is_successful= false;
}
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;
}
}
memcached_set_purging(root, false);
- return ret;
+ return is_successful;
}