1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-02 07:43:09 +00:00

Fix error when set max_connections to 0 (#366)

This commit is contained in:
feiniks 2020-06-28 12:02:46 +08:00 committed by GitHub
parent 95bef26164
commit cf7e938a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -108,6 +108,7 @@ mysql_conn_pool_get_connection (SeafDB *db)
if (pool->max_connections == 0) {
conn = mysql_db_get_connection (db);
conn->pool = pool;
return conn;
}

View File

@ -105,11 +105,15 @@ mysql_db_start (SeafileSession *session)
charset = seaf_key_file_get_string (session->config,
"database", "connection_charset", NULL);
if (error)
g_clear_error (&error);
max_connections = g_key_file_get_integer (session->config,
"database", "max_connections",
NULL);
if (max_connections <= 0)
&error);
if (error || max_connections < 0) {
g_clear_error (&error);
max_connections = DEFAULT_MAX_CONNECTIONS;
}
session->db = seaf_db_new_mysql (host, port, user, passwd, db, unix_socket, use_ssl, charset, max_connections);
if (!session->db) {
@ -123,8 +127,6 @@ mysql_db_start (SeafileSession *session)
g_free (db);
g_free (unix_socket);
g_free (charset);
if (error)
g_clear_error (&error);
return 0;
}