1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-27 21:10:59 +01:00

Change sqlite_init_multithreaded return type to void

to satisfy pthread_once() interface because
previously return from sqlite_init_multithreaded
was not used
This commit is contained in:
Serhii Charykov 2021-04-26 23:47:11 +03:00
parent 2d12ad4f29
commit 0f7ff3ec4a

View File

@ -95,7 +95,7 @@ static void sqlite_unlock(int write)
////////////////////////////////////////////////// //////////////////////////////////////////////////
static int sqlite_init_multithreaded(void) { static void sqlite_init_multithreaded(void) {
#if defined(SQLITE_CONFIG_MULTITHREAD) #if defined(SQLITE_CONFIG_MULTITHREAD)
if (sqlite3_threadsafe() > 0) { if (sqlite3_threadsafe() > 0) {
@ -104,16 +104,14 @@ static int sqlite_init_multithreaded(void) {
retCode = sqlite3_config(SQLITE_CONFIG_SERIALIZED); retCode = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
if (retCode != SQLITE_OK) { if (retCode != SQLITE_OK) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "setting sqlite thread safe mode to serialized failed!!! return code: %d\n", retCode); TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "setting sqlite thread safe mode to serialized failed!!! return code: %d\n", retCode);
return -1; return;
} }
} }
} else { } else {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Your SQLite database is not compiled to be threadsafe.\n"); TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Your SQLite database is not compiled to be threadsafe.\n");
return -1; return;
} }
#endif #endif
return 0;
} }
static int donot_print_connection_success = 0; static int donot_print_connection_success = 0;
@ -179,7 +177,7 @@ static sqlite3 * get_sqlite_connection(void) {
sqlite3 *sqliteconnection = (sqlite3 *)pthread_getspecific(connection_key); sqlite3 *sqliteconnection = (sqlite3 *)pthread_getspecific(connection_key);
if(!sqliteconnection) { if(!sqliteconnection) {
fix_user_directory(pud->userdb); fix_user_directory(pud->userdb);
(void) pthread_once(&sqlite_init_once, (void (*)(void))sqlite_init_multithreaded); (void) pthread_once(&sqlite_init_once, sqlite_init_multithreaded);
int rc = sqlite3_open(pud->userdb, &sqliteconnection); int rc = sqlite3_open(pud->userdb, &sqliteconnection);
if(!sqliteconnection || (rc != SQLITE_OK)) { if(!sqliteconnection || (rc != SQLITE_OK)) {
const char* errmsg = sqlite3_errmsg(sqliteconnection); const char* errmsg = sqlite3_errmsg(sqliteconnection);