[sr-dev] git:3.1: usrloc(k): request a db connection per child

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 31 09:46:15 CEST 2011


Module: sip-router
Branch: 3.1
Commit: 97f788a3f1e4e993c99fb1225a1fbcbe4ff0ffc8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=97f788a3f1e4e993c99fb1225a1fbcbe4ff0ffc8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Aug 31 09:38:28 2011 +0200

usrloc(k): request a db connection per child

- avoid sharing the connection between processes
- reported by MÉSZÁROS Mihály
(cherry picked from commit d593078c2e0bb123d56de2d440473cc12a08fba6)

---

 modules_k/usrloc/ul_mod.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/modules_k/usrloc/ul_mod.c b/modules_k/usrloc/ul_mod.c
index 7a1cdbd..00c730a 100644
--- a/modules_k/usrloc/ul_mod.c
+++ b/modules_k/usrloc/ul_mod.c
@@ -340,8 +340,7 @@ static int child_init(int _rank)
 			break;
 	}
 
-	if (!ul_dbh)
-		ul_dbh = ul_dbf.init(&db_url); /* Get a new database connection */
+	ul_dbh = ul_dbf.init(&db_url); /* Get a database connection per child */
 	if (!ul_dbh) {
 		LM_ERR("child(%d): failed to connect to database\n", _rank);
 		return -1;
@@ -371,10 +370,6 @@ static int mi_child_init(void)
 		return 0;
 
 	if (db_mode != NO_DB) {
-		if (ul_dbh) {
-			done = 1;
-			return 0;
-		}
 		ul_dbh = ul_dbf.init(&db_url);
 		if (!ul_dbh) {
 			LM_ERR("failed to connect to database\n");




More information about the sr-dev mailing list