[sr-dev] git:master: modules_k/pua: Use non-pooled connections in db only mode ( where supported)

Peter Dunkley peter.dunkley at crocodile-rcs.com
Sun May 13 02:29:07 CEST 2012


Module: sip-router
Branch: master
Commit: 126131202c76337103d67402940d0a2d6438e3e8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=126131202c76337103d67402940d0a2d6438e3e8

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Sun May 13 01:17:56 2012 +0100

modules_k/pua: Use non-pooled connections in db only mode (where supported)

- This helps with databases (such as PostgreSQL, which is the only one that
  currently supports specifying non-pooled connections) that create a server
  process per client connection.

---

 modules_k/pua/pua.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules_k/pua/pua.c b/modules_k/pua/pua.c
index 5d11066..b72f9e1 100644
--- a/modules_k/pua/pua.c
+++ b/modules_k/pua/pua.c
@@ -296,7 +296,11 @@ static int child_init(int rank)
 		LM_CRIT("database not bound\n");
 		return -1;
 	}
-	pua_db = pua_dbf.init(&db_url);
+	/* In DB only mode do not pool the connections where possible. */
+	if (dbmode == PUA_DB_ONLY && pua_dbf.init2)
+		pua_db = pua_dbf.init2(&db_url, DB_POOLING_NONE);
+	else
+		pua_db = pua_dbf.init(&db_url);
 	if (!pua_db)
 	{
 		LM_ERR("Child %d: connecting to database failed\n", rank);
@@ -321,7 +325,11 @@ static int mi_child_init(void)
 		LM_CRIT("database not bound\n");
 		return -1;
 	}
-	pua_db = pua_dbf.init(&db_url);
+	/* In DB only mode do not pool the connections where possible. */
+	if (dbmode == PUA_DB_ONLY && pua_dbf.init2)
+		pua_db = pua_dbf.init2(&db_url, DB_POOLING_NONE);
+	else
+		pua_db = pua_dbf.init(&db_url);
 	if (!pua_db)
 	{
 		LM_ERR("connecting to database failed\n");




More information about the sr-dev mailing list