Sfoglia il codice sorgente

Merge pull request #1516 from tiglat/tiglat/nathelper_doesnt_ping_all_contacts

nathelper: it doesn't ping contacts if ping_nated_only=0
Daniel-Constantin Mierla 7 anni fa
parent
commit
cb80d6b933
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      src/modules/nathelper/nathelper.c

+ 4 - 4
src/modules/nathelper/nathelper.c

@@ -1921,6 +1921,7 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 	unsigned int path_ip = 0;
 	unsigned short path_port = 0;
 	int options = 0;
+	int should_send_ping = 0;
 
 	if((*natping_state) == 0)
 		goto done;
@@ -2059,10 +2060,9 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 		dst.proto = PROTO_UDP;
 		dst.send_sock = send_sock;
 
-		if((flags & sipping_flag) != 0
-				&& (opt.s = build_sipping(
-							&c, send_sock, &path, &ruid, aorhash, &opt.len))
-						   != 0) {
+		should_send_ping = (flags & sipping_flag) != 0 || ping_nated_only == 0;
+
+		if ( should_send_ping && (opt.s = build_sipping(&c, send_sock, &path, &ruid, aorhash, &opt.len)) != 0) {
 			if(udp_send(&dst, opt.s, opt.len) < 0) {
 				LM_ERR("sip udp_send failed\n");
 			}