Module: kamailio
Branch: 5.7
Commit: bfb7cbcaa16e5f392cc77d7e2e8ea2b75064ace0
URL:
https://github.com/kamailio/kamailio/commit/bfb7cbcaa16e5f392cc77d7e2e8ea2b…
Author: S-P Chan <shihping.chan(a)gmail.com>
Committer: S-P Chan <shihping.chan(a)gmail.com>
Date: 2024-02-04T08:12:52+08:00
db_mysql: init libssl in a thread
From:
- 5dffb934a2f7f986fdc09e433833991c54612646
- 733a268114261d49ed11aec83fe39ea8c34a0b69
---
Modified: src/modules/db_mysql/km_dbase.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bfb7cbcaa16e5f392cc77d7e2e8ea2b…
Patch:
https://github.com/kamailio/kamailio/commit/bfb7cbcaa16e5f392cc77d7e2e8ea2b…
---
diff --git a/src/modules/db_mysql/km_dbase.c b/src/modules/db_mysql/km_dbase.c
index 577f3dc798b..9cd238b78ab 100644
--- a/src/modules/db_mysql/km_dbase.c
+++ b/src/modules/db_mysql/km_dbase.c
@@ -38,6 +38,7 @@
#include "../../core/mem/mem.h"
#include "../../core/dprint.h"
#include "../../core/async_task.h"
+#include "../../core/rthreads.h"
#include "../../lib/srdb1/db_query.h"
#include "../../lib/srdb1/db_ut.h"
#include "db_mysql.h"
@@ -197,8 +198,10 @@ static char *db_mysql_tquote = "`";
* No function should be called before this
* \param _url URL used for initialization
* \return zero on success, negative value on failure
+ *
+ * Init libssl in a thread
*/
-db1_con_t *db_mysql_init(const str *_url)
+static db1_con_t *db_mysql_init0(const str *_url)
{
db1_con_t *c;
c = db_do_init(_url, (void *)db_mysql_new_connection);
@@ -208,6 +211,10 @@ db1_con_t *db_mysql_init(const str *_url)
}
+db1_con_t *db_mysql_init(const str *_url)
+{
+ return run_threadP((_thread_proto)db_mysql_init0, (void *)_url);
+}
/**
* Shut down the database module.
* No function should be called after this