X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ffunction.c;h=fb7abd6fb96ea594e1381c4b8cc80be6c755d22e;hb=99b3d2acf40a4e408b13e06e2e97db9c20b72908;hp=1cfd96a4f32660e8d4e3e4f18ffe4380881162f4;hpb=6f42f1c77da54da0b19274cc0d6b6c9745e40de0;p=awesomized%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index 1cfd96a4..fb7abd6f 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2597,16 +2597,26 @@ memcached_return pre_behavior_ketama_weighted(memcached_st *memc) memcached_return pre_binary(memcached_st *memc) { - memcached_return rc; - - rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); - assert(rc == MEMCACHED_SUCCESS); + memcached_return rc= MEMCACHED_FAILURE; + memcached_st *clone; - assert(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1); + clone= memcached_clone(NULL, memc); + assert(clone); + // The memcached_version needs to be done on a clone, because the server + // will not toggle protocol on an connection. + memcached_version(clone); - return MEMCACHED_SUCCESS; + if (clone->hosts[0].major_version >= 1 && clone->hosts[0].minor_version > 2) + { + rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); + assert(rc == MEMCACHED_SUCCESS); + assert(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1); + } + memcached_free(clone); + return rc; } + void my_free(memcached_st *ptr, void *mem) { free(mem); @@ -2967,7 +2977,7 @@ test_st consistent_weighted_tests[] ={ collection_st collection[] ={ {"block", 0, 0, tests}, -// {"binary", pre_binary, 0, tests}, + {"binary", pre_binary, 0, tests}, {"nonblock", pre_nonblock, 0, tests}, {"nodelay", pre_nodelay, 0, tests}, {"settimer", pre_settimer, 0, tests},