X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached_purge.c;h=9042142b1819cf22b5df90ff2ffbeed893ce04b0;hb=b4de8d3fd063b9017797dd9809ab3acb8a537606;hp=40c8ad61a5af5d0e956e2a4c246601d9fcf1acf3;hpb=acce29c292b435fef4fd486495dca7d653be2bf2;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached_purge.c b/libmemcached/memcached_purge.c index 40c8ad61..9042142b 100644 --- a/libmemcached/memcached_purge.c +++ b/libmemcached/memcached_purge.c @@ -2,30 +2,30 @@ #include "memcached_io.h" #include "memcached_constants.h" -memcached_return memcached_purge(memcached_server_st *ptr) +memcached_return_t memcached_purge(memcached_server_st *ptr) { uint32_t x; - memcached_return ret= MEMCACHED_SUCCESS; + memcached_return_t ret= MEMCACHED_SUCCESS; - if (ptr->root->purging || /* already purging */ + if (ptr->root->options.is_purging || /* already purging */ (memcached_server_response_count(ptr) < ptr->root->io_msg_watermark && - ptr->io_bytes_sent < ptr->root->io_bytes_watermark) || - (ptr->io_bytes_sent > ptr->root->io_bytes_watermark && - memcached_server_response_count(ptr) < 2)) + ptr->io_bytes_sent < ptr->root->io_bytes_watermark) || + (ptr->io_bytes_sent >= ptr->root->io_bytes_watermark && + memcached_server_response_count(ptr) < 2)) { return MEMCACHED_SUCCESS; } /* memcached_io_write and memcached_response may call memcached_purge - so we need to be able stop any recursion.. */ - ptr->root->purging= 1; + so we need to be able stop any recursion.. */ + ptr->root->options.is_purging= true; WATCHPOINT_ASSERT(ptr->fd != -1); /* Force a flush of the buffer to ensure that we don't have the n-1 pending - requests buffered up.. */ + requests buffered up.. */ if (memcached_io_write(ptr, NULL, 0, 1) == -1) { - ptr->root->purging= 0; + ptr->root->options.is_purging= true; return MEMCACHED_WRITE_FAILURE; } WATCHPOINT_ASSERT(ptr->fd != -1); @@ -41,7 +41,7 @@ memcached_return memcached_purge(memcached_server_st *ptr) * We need to increase the timeout, because we might be waiting for * data to be sent from the server (the commands was in the output buffer * and just flushed - */ + */ int32_t timeo= ptr->root->poll_timeout; ptr->root->poll_timeout= 2000; @@ -51,14 +51,14 @@ memcached_return memcached_purge(memcached_server_st *ptr) for (x= 0; x < no_msg; x++) { memcached_result_reset(result_ptr); - memcached_return rc= memcached_read_one_response(ptr, buffer, - sizeof (buffer), - result_ptr); + memcached_return_t rc= memcached_read_one_response(ptr, buffer, + sizeof (buffer), + 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 * protocol or have problems reading data from the network.. - */ + */ if (rc== MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_UNKNOWN_READ_FAILURE) { WATCHPOINT_ERROR(rc); @@ -70,7 +70,7 @@ memcached_return memcached_purge(memcached_server_st *ptr) memcached_result_free(result_ptr); ptr->root->poll_timeout= timeo; } - ptr->root->purging= 0; + ptr->root->options.is_purging= false; return ret; }