Patch amqp_pdisconnect.patch for amqp Bug #62549
Patch version 2012-07-13 12:34 UTC
Return to Bug #62549 |
Download this patch
Patch Revisions:
Developer: dyeldandi@gramant.ru
diff -ruwB amqp-1.0.1/amqp.c amqp-1.0.1.pdisconnect/amqp.c
--- amqp-1.0.1/amqp.c 2012-07-13 16:11:36.546045436 +0400
+++ amqp-1.0.1.pdisconnect/amqp.c 2012-07-13 16:06:51.336583015 +0400
@@ -81,6 +81,9 @@
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_disconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_pdisconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_reconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
@@ -367,6 +370,7 @@
PHP_ME(amqp_connection_class, connect, arginfo_amqp_connection_class_connect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, pconnect, arginfo_amqp_connection_class_pconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, disconnect, arginfo_amqp_connection_class_disconnect, ZEND_ACC_PUBLIC)
+ PHP_ME(amqp_connection_class, pdisconnect, arginfo_amqp_connection_class_pdisconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, reconnect, arginfo_amqp_connection_class_reconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getLogin, arginfo_amqp_connection_class_getLogin, ZEND_ACC_PUBLIC)
diff -ruwB amqp-1.0.1/amqp_connection.c amqp-1.0.1.pdisconnect/amqp_connection.c
--- amqp-1.0.1/amqp_connection.c 2012-07-13 16:11:36.549045433 +0400
+++ amqp-1.0.1.pdisconnect/amqp_connection.c 2012-07-13 16:12:11.777628083 +0400
@@ -577,6 +577,46 @@
/* }}} */
+
+/* {{{ proto amqp:pdisconnect()
+destroy amqp persistent connection */
+PHP_METHOD(amqp_connection_class, pdisconnect)
+{
+ char *key;
+ int key_len;
+
+ zval *id;
+ amqp_connection_object *connection;
+
+
+ /* Try to pull amqp object out of method params */
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, amqp_connection_class_entry) == FAILURE) {
+ return;
+ }
+
+ /* Get the connection object out of the store */
+ connection = (amqp_connection_object *)zend_object_store_get_object(id TSRMLS_CC);
+
+ if (!connection->connection_resource->is_persistent) {
+ RETURN_FALSE;
+ }
+
+ key_len = spprintf(&key, 0, "amqp_conn_res_%s_%d_%s_%s", connection->host, connection->port, connection->vhost, connection->login);
+
+ if (zend_hash_exists(&EG(persistent_list), key, key_len + 1)) {
+ zend_hash_del(&EG(persistent_list), key, key_len + 1);
+ }
+
+ connection->connection_resource->is_persistent = 0;
+
+ php_amqp_disconnect(connection);
+
+ RETURN_TRUE;
+}
+
+/* }}} */
+
+
/* {{{ proto amqp::reconnect()
recreate amqp connection */
PHP_METHOD(amqp_connection_class, reconnect)
diff -ruwB amqp-1.0.1/amqp_connection.h amqp-1.0.1.pdisconnect/amqp_connection.h
--- amqp-1.0.1/amqp_connection.h 2012-07-13 16:11:36.736045179 +0400
+++ amqp-1.0.1.pdisconnect/amqp_connection.h 2012-07-13 16:06:51.337583034 +0400
@@ -39,6 +39,7 @@
PHP_METHOD(amqp_connection_class, connect);
PHP_METHOD(amqp_connection_class, pconnect);
PHP_METHOD(amqp_connection_class, disconnect);
+PHP_METHOD(amqp_connection_class, pdisconnect);
PHP_METHOD(amqp_connection_class, reconnect);
PHP_METHOD(amqp_connection_class, getLogin);
Binary files amqp-1.0.1/.svn/wc.db and amqp-1.0.1.pdisconnect/.svn/wc.db differ
|