Skip to content

Commit

Permalink
Add setReconnectDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Oct 5, 2013
1 parent d7915c1 commit 19e3b49
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ PHP_METHOD(Mosquitto_Client, clearWill)
}
/* }}} */

/* {{{ */
PHP_METHOD(Mosquitto_Client, setReconnectDelay)
{
mosquitto_client_object *object;
int retval;
long reconnect_delay = 0, reconnect_delay_max = 0;
zend_bool exponential_backoff = 0;

PHP_MOSQUITTO_ERROR_HANDLING();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lb",
&reconnect_delay, &reconnect_delay_max, &exponential_backoff) == FAILURE) {
PHP_MOSQUITTO_RESTORE_ERRORS();
return;
}
PHP_MOSQUITTO_RESTORE_ERRORS();

object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
retval = mosquitto_reconnect_delay_set(object->client, reconnect_delay, reconnect_delay_max, exponential_backoff);

php_mosquitto_handle_errno(retval, errno);
}
/* }}} */

/* {{{ */
PHP_METHOD(Mosquitto_Client, connect)
{
Expand Down Expand Up @@ -646,6 +669,7 @@ const zend_function_entry mosquitto_client_methods[] = {
PHP_ME(Mosquitto_Client, setCredentials, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, setWill, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, clearWill, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, setReconnectDelay, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, connect, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, disconnect, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Mosquitto_Client, publish, NULL, ZEND_ACC_PUBLIC)
Expand Down

0 comments on commit 19e3b49

Please sign in to comment.