com php-src: close persistent memcache connections on timeout: main/main.c
| From: | Antony Dovgal | Date: | Thu, 12 Dec 2013 08:47:40 +0000 |
| Subject: | com php-src: close persistent memcache connections on timeout: main/main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76654@lists.php.net to get a copy of this message | ||
Commit: 8866508f88998ccbca0777f699bce316d4fed4b9
Author: Antony Dovgal <tony@daylessday.org> Sat, 31 Dec 2011 00:33:25 +0400
Committer: Antony Dovgal <tony2001@php.net> Thu, 12 Dec 2013 12:47:40 +0400
Parents: eb289b501583a137c39c64fbb421a0759dc5cbf0
Branches: badoo-5..5_mysqlnd
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8866508f88998ccbca0777f699bce316d4fed4b9
Log:
close persistent memcache connections on timeout
Changed paths:
M main/main.c
Diff:
diff --git a/main/main.c b/main/main.c
index 8e3f164..e1d8570 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1484,10 +1484,26 @@ static void php_message_handler_for_zend(long message, const void *data
TSRMLS_D
/* }}} */
+static int close_memcache_persistent_connections(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
+{
+ char *type_name;
+
+ type_name = zend_rsrc_list_get_rsrc_type(rsrc->type);
+ if (type_name && strcmp(type_name, "persistent memcache connection") == 0) {
+ return ZEND_HASH_APPLY_REMOVE;
+ }
+ return ZEND_HASH_APPLY_KEEP;
+}
+/* }}} */
+
void php_on_timeout(int seconds TSRMLS_DC)
{
PG(connection_status) |= PHP_CONNECTION_TIMEOUT;
zend_set_timeout(EG(timeout_seconds), 1);
+
+ /* close memcache persistent connections on timeout */
+ zend_hash_apply(&EG(persistent_list), (apply_func_t)close_memcache_persistent_connections
TSRMLS_CC);
+
if(PG(exit_on_timeout)) sapi_terminate_process(TSRMLS_C);
}