--- a/lib/srdb1/db_id.c +++ b/lib/srdb1/db_id.c @@ -241,6 +241,7 @@ LM_ERR("error while parsing database URL: '%.*s' \n", url->len, url->s); goto err; } + ptr->pid=getpid(); return ptr; @@ -260,6 +261,7 @@ { if (!id1 || !id2) return 0; if (id1->port != id2->port) return 0; + if (((int)id1->pid) != ((int)id2->pid)) return 0; if (strcmp(id1->scheme, id2->scheme)) return 0; if (id1->username!=0 && id2->username!=0) { --- a/lib/srdb1/db_id.h +++ b/lib/srdb1/db_id.h @@ -31,6 +31,7 @@ #define _DB1_ID_H #include "../../str.h" +#include /** Structure representing a database ID */ struct db_id { @@ -40,6 +41,7 @@ char* host; /**< Host or IP, case insensitive */ unsigned short port; /**< Port number */ char* database; /**< Database, case sensitive */ + pid_t pid; /**< Process ID (only allow one database connection per thread */ };