Bläddra i källkod

dmq: added remove_inactive parameter

Viktor Litvinov 7 månader sedan
förälder
incheckning
bd62a2fcd2

+ 2 - 0
src/modules/dmq/dmq.c

@@ -68,6 +68,7 @@ str dmq_notification_channel = str_init("notification_peer");
 int dmq_multi_notify = 0;
 static sip_uri_t dmq_notification_uri = {0};
 int dmq_ping_interval = 60;
+int dmq_remove_inactive = 1;
 
 /* TM bind */
 struct tm_binds _dmq_tmb = {0};
@@ -125,6 +126,7 @@ static param_export_t params[] = {
 	{"notification_channel", PARAM_STR, &dmq_notification_channel},
 	{"multi_notify", PARAM_INT, &dmq_multi_notify},
 	{"worker_usleep", PARAM_INT, &dmq_worker_usleep},
+	{"remove_inactive", PARAM_INT, &dmq_remove_inactive},
 	{0, 0, 0}
 };
 

+ 1 - 0
src/modules/dmq/dmq.h

@@ -50,6 +50,7 @@ extern str dmq_server_socket;
 extern sip_uri_t dmq_server_uri;
 extern str_list_t *dmq_notification_address_list;
 extern int dmq_multi_notify;
+extern int dmq_remove_inactive;
 /* sl and tm */
 extern struct tm_binds _dmq_tmb;
 extern sl_api_t _dmq_slb;

+ 20 - 0
src/modules/dmq/doc/dmq_admin.xml

@@ -297,6 +297,26 @@ modparam("dmq", "ping_interval", 90)
 </programlisting>
                 </example>
         </section>
+	<section id="dmq.p.remove_inactive">
+		<title><varname>remove_inactive</varname>(int)</title>
+		<para>
+		A value of zero disable removing dmq nodes. Node status will be changed to pending.
+		A non-zero value (default is 1) enable removing nodes.
+		For node that is defined as notification address status will be changed to pending.
+		Otherwise it will be marked as disabled and then will be removed.
+		</para>
+		<para>
+		<emphasis>Default value is <quote>1</quote>.</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>remove_inactive</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("dmq", "remove_inactive", 0)
+...
+</programlisting>
+		</example>
+	</section>
 	</section>
 
 	<section>

+ 5 - 0
src/modules/dmq/notification_peer.c

@@ -628,6 +628,11 @@ int notification_resp_callback_f(
 			run_init_callbacks();
 		}
 	} else if(code == 408) {
+		if(!dmq_remove_inactive) {
+			/* put the node in pending state */
+			update_dmq_node_status(dmq_node_list, node, DMQ_NODE_PENDING);
+			return 0;
+		}
 		/* TODO this probably do not work for dmq_multi_notify */
 		slp = dmq_notification_address_list;
 		while(slp != NULL) {