浏览代码

db_postgress: disable initialization of libssl if tls is loaded

- based on the note from docs to avoid double attempt to init the ssl
  library
- http://www.postgresql.org/docs/9.4/static/libpq-ssl.html
Daniel-Constantin Mierla 10 年之前
父节点
当前提交
f04dec82e9
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      modules/db_postgres/km_pg_con.c

+ 4 - 0
modules/db_postgres/km_pg_con.c

@@ -30,6 +30,7 @@
 #include "../../mem/mem.h"
 #include "../../dprint.h"
 #include "../../ut.h"
+#include "../../tls_hooks_init.h" 
 #include <string.h>
 #include <time.h>
 #include <netinet/in.h>
@@ -98,6 +99,9 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
 
 	keywords[i] = values[i] = NULL;
 
+	/* don't attempt to re-init openssl if done already */
+	if(tls_loaded()) PQinitSSL(0);
+
 	ptr->con = PQconnectdbParams(keywords, values, 1);
 	LM_DBG("PQconnectdbParams(%p)\n", ptr->con);