From: Brian Aker Date: Fri, 16 Jul 2010 03:54:57 +0000 (-0700) Subject: Possible fix for OSX slow server startup X-Git-Tag: 0.44~21 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=3d4c56794c26b9642b1d6b883b7883969ba84346;p=m6w6%2Flibmemcached Possible fix for OSX slow server startup --- diff --git a/libmemcached/response.c b/libmemcached/response.c index 491b4cc8..867a999e 100644 --- a/libmemcached/response.c +++ b/libmemcached/response.c @@ -61,6 +61,7 @@ memcached_return_t memcached_response(memcached_server_write_instance_st ptr, * compatibility. */ if (ptr->root->flags.binary_protocol == false) + { while (memcached_server_response_count(ptr) > 1) { memcached_return_t rc= memcached_read_one_response(ptr, buffer, buffer_length, result); @@ -75,6 +76,7 @@ memcached_return_t memcached_response(memcached_server_write_instance_st ptr, rc != MEMCACHED_DATA_EXISTS) return rc; } + } return memcached_read_one_response(ptr, buffer, buffer_length, result); } diff --git a/libmemcached/util/version.c b/libmemcached/util/version.c index e5b5ae1d..7c936c71 100644 --- a/libmemcached/util/version.c +++ b/libmemcached/util/version.c @@ -49,7 +49,8 @@ bool libmemcached_util_version_check(memcached_st *memc, memcached_server_fn callbacks[1]; memcached_version(memc); - struct local_context check= { .major_version= major_version, .minor_version= minor_version, .micro_version= micro_version, .truth= true }; + struct local_context check= { .major_version= major_version, .minor_version= minor_version, .micro_version= micro_version, .truth= true }; + memcached_version(memc); callbacks[0]= check_server_version; memcached_server_cursor(memc, callbacks, (void *)&check, 1); diff --git a/libmemcached/version.c b/libmemcached/version.c index ba0b243e..54545cb9 100644 --- a/libmemcached/version.c +++ b/libmemcached/version.c @@ -13,10 +13,19 @@ memcached_return_t memcached_version(memcached_st *ptr) if (ptr->flags.use_udp) return MEMCACHED_NOT_SUPPORTED; + bool was_blocking= ptr->flags.no_block; + memcached_return_t rc; + + ptr->flags.no_block= false; + if (ptr->flags.binary_protocol) - return memcached_version_binary(ptr); + rc= memcached_version_binary(ptr); else - return memcached_version_textual(ptr); + rc= memcached_version_textual(ptr); + + ptr->flags.no_block= was_blocking; + + return rc; } static inline memcached_return_t memcached_version_textual(memcached_st *ptr)