blob: b11a3204a6c77bbf8bddf3ad0064ef5d73fda611 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
--- 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 <sys/types.h>
/** 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 */
};
|