Browse code

dmq: exposed the server socket to modparam list

Daniel-Constantin Mierla authored on 21/04/2021 08:49:39
Showing 1 changed files
... ...
@@ -118,6 +118,7 @@ static param_export_t params[] = {
118 118
 	{"num_workers", INT_PARAM, &dmq_num_workers},
119 119
 	{"ping_interval", INT_PARAM, &dmq_ping_interval},
120 120
 	{"server_address", PARAM_STR, &dmq_server_address},
121
+	{"server_socket", PARAM_STR, &dmq_server_socket},
121 122
 	{"notification_address", PARAM_STR|USE_FUNC_PARAM, dmq_add_notification_address},
122 123
 	{"notification_channel", PARAM_STR, &dmq_notification_channel},
123 124
 	{"multi_notify", INT_PARAM, &dmq_multi_notify},
... ...
@@ -229,10 +230,12 @@ static int mod_init(void)
229 230
 		return -1;
230 231
 	}
231 232
 
232
-	/* create socket string out of the server_uri */
233
-	if(make_socket_str_from_uri(&dmq_server_uri, &dmq_server_socket) < 0) {
234
-		LM_ERR("failed to create socket out of server_uri\n");
235
-		return -1;
233
+	if(dmq_server_socket.s==NULL || dmq_server_socket.len<=0) {
234
+		/* create socket string out of the server_uri */
235
+		if(make_socket_str_from_uri(&dmq_server_uri, &dmq_server_socket) < 0) {
236
+			LM_ERR("failed to create socket out of server_uri\n");
237
+			return -1;
238
+		}
236 239
 	}
237 240
 	if(lookup_local_socket(&dmq_server_socket) == NULL) {
238 241
 		LM_ERR("server_uri is not a socket the proxy is listening on\n");
... ...
@@ -354,9 +357,6 @@ static void destroy(void)
354 357
 		dmq_self_node->status = DMQ_NODE_DISABLED;
355 358
 		request_nodelist(dmq_notification_node, 1);
356 359
 	}
357
-	if(dmq_server_socket.s) {
358
-		pkg_free(dmq_server_socket.s);
359
-	}
360 360
 	if(dmq_init_callback_done) {
361 361
 		shm_free(dmq_init_callback_done);
362 362
 	}