Skip to content

Commit a452d9a

Browse files
authored
MOD: don't re-set the libmemcached option if not modified (#451)
libmemcached would close all connections if the option(like MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) was set, even though value wasn't modified.
1 parent 38ad2e0 commit a452d9a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

php_memcached.c

+5
Original file line numberDiff line numberDiff line change
@@ -3104,6 +3104,11 @@ int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)
31043104
lval = zval_get_long(value);
31053105

31063106
if (flag < MEMCACHED_BEHAVIOR_MAX) {
3107+
// don't reset the option when the option value wasn't modified,
3108+
// while the libmemcached may shutdown all connections.
3109+
if (memcached_behavior_get(intern->memc, flag) == (uint64_t)lval) {
3110+
return 1;
3111+
}
31073112
rc = memcached_behavior_set(intern->memc, flag, (uint64_t)lval);
31083113
}
31093114
else {

0 commit comments

Comments
 (0)