From d7a0084bf99d618d1dc26a54fd413db7ae8b8e63 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 19 Aug 2020 16:22:08 +0200 Subject: [PATCH] libmemcached: fix pipelining with memcached 1.6 --- src/libmemcached/purge.cc | 9 ++++++--- src/libmemcached/response.cc | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libmemcached/purge.cc b/src/libmemcached/purge.cc index 7f54672c..10c133f2 100644 --- a/src/libmemcached/purge.cc +++ b/src/libmemcached/purge.cc @@ -62,11 +62,11 @@ private: class PollTimeout { public: - PollTimeout(Memcached* arg) : + PollTimeout(Memcached* arg, int32_t ms = 50) : _timeout(arg->poll_timeout), _origin(arg->poll_timeout) { - _origin = 2000; + _origin = ms; } ~PollTimeout() @@ -135,12 +135,15 @@ bool memcached_purge(memcached_instance_st* 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 or rc == MEMCACHED_UNKNOWN_READ_FAILURE or rc == MEMCACHED_READ_FAILURE) { WATCHPOINT_ERROR(rc); is_successful= false; } + if (rc == MEMCACHED_TIMEOUT) { + break; + } if (ptr->root->callbacks != NULL) { diff --git a/src/libmemcached/response.cc b/src/libmemcached/response.cc index d2e2603f..8c4eb988 100644 --- a/src/libmemcached/response.cc +++ b/src/libmemcached/response.cc @@ -858,7 +858,7 @@ static memcached_return_t _read_one_response(memcached_instance_st* instance, rc= textual_read_one_response(instance, buffer, buffer_length, result); } - if (memcached_fatal(rc)) + if (memcached_fatal(rc) && rc != MEMCACHED_TIMEOUT) { memcached_io_reset(instance); } -- 2.30.2