size_t length, my_bool skipp_check, void *opt_arg);
my_bool mariadb_db_dsn_reconnect(MYSQL *mysql);
+my_bool reconnect = 1;
+
#define DEFAULT_MARIADB_RETRIES 120
#ifndef MIN
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connecting %s\n", handle->dsn);
mysql_init(&handle->con);
- // Enable non-blocking operation
- // https://mariadb.com/kb/en/library/using-the-non-blocking-library/
+ /* Enable non-blocking operation */
+ /* https://mariadb.com/kb/en/library/using-the-non-blocking-library */
mysql_options(&handle->con, MYSQL_OPT_NONBLOCK, 0);
+ /* Enable automatic reconnect with the mariadb_reconnect function, without this that function does not work */
+ mysql_options(&handle->con, MYSQL_OPT_RECONNECT, &reconnect);
+
/* set timeouts to 300 microseconds */
/*int default_timeout = 3;
mysql_options(&handle->con, MYSQL_OPT_READ_TIMEOUT, &default_timeout);