[dovecot-cvs] dovecot/src/auth db-sql.c, 1.1, 1.2 db-sql.h, 1.1, 1.2 passdb-sql.c, 1.18, 1.19 userdb-sql.c, 1.8, 1.9

cras at dovecot.org cras at dovecot.org
Thu Jun 9 21:44:48 EEST 2005


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv6780/auth

Modified Files:
	db-sql.c db-sql.h passdb-sql.c userdb-sql.c 
Log Message:
Don't connect to SQL database in main dovecot-auth process if we're using
workers to do it.



Index: db-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-sql.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- db-sql.c	15 Oct 2004 23:12:52 -0000	1.1
+++ db-sql.c	9 Jun 2005 18:44:46 -0000	1.2
@@ -82,18 +82,13 @@
 		i_fatal("sql: connect string not set in configuration file %s",
 			config_path);
 	}
+	conn->db = sql_init(conn->set.driver, conn->set.connect);
 
 	conn->next = connections;
 	connections = conn;
 	return conn;
 }
 
-void db_sql_connect(struct sql_connection *conn)
-{
-	if (conn->db == NULL)
-		conn->db = sql_init(conn->set.driver, conn->set.connect);
-}
-
 void db_sql_unref(struct sql_connection *conn)
 {
 	if (--conn->refcount > 0)

Index: db-sql.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-sql.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- db-sql.h	15 Oct 2004 23:12:52 -0000	1.1
+++ db-sql.h	9 Jun 2005 18:44:46 -0000	1.2
@@ -25,6 +25,4 @@
 struct sql_connection *db_sql_init(const char *config_path);
 void db_sql_unref(struct sql_connection *conn);
 
-void db_sql_connect(struct sql_connection *conn);
-
 #endif

Index: passdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-sql.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- passdb-sql.c	21 Apr 2005 16:15:44 -0000	1.18
+++ passdb-sql.c	9 Jun 2005 18:44:46 -0000	1.19
@@ -180,10 +180,11 @@
 {
 	enum sql_db_flags flags;
 
-	db_sql_connect(passdb_sql_conn);
-
 	flags = sql_get_flags(passdb_sql_conn->db);
 	passdb_sql.blocking = (flags & SQL_DB_FLAG_BLOCKING) != 0;
+
+	if (!passdb_sql.blocking || worker)
+                sql_connect(passdb_sql_conn->db);
 }
 
 static void passdb_sql_deinit(void)

Index: userdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-sql.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- userdb-sql.c	28 Feb 2005 22:19:21 -0000	1.8
+++ userdb-sql.c	9 Jun 2005 18:44:46 -0000	1.9
@@ -129,10 +129,11 @@
 {
 	enum sql_db_flags flags;
 
-	db_sql_connect(userdb_sql_conn);
-
 	flags = sql_get_flags(userdb_sql_conn->db);
 	userdb_sql.blocking = (flags & SQL_DB_FLAG_BLOCKING) != 0;
+
+	if (!userdb_sql.blocking || worker)
+		sql_connect(userdb_sql_conn->db);
 }
 
 static void userdb_sql_deinit(void)



More information about the dovecot-cvs mailing list