Diff of /getifaddr.c [2e6833] .. [c96e6e]  Maximize  Restore

Switch to side-by-side view

--- a/getifaddr.c
+++ b/getifaddr.c
@@ -63,7 +63,7 @@
 #include "log.h"
 
 static int
-getifaddr(const char *ifname)
+getifaddr(const char *ifname, int notify)
 {
 #if HAVE_GETIFADDRS
 	struct ifaddrs *ifap, *p;
@@ -95,8 +95,9 @@
 		lan_addr[n_lan_addr].snotify = OpenAndConfSSDPNotifySocket(lan_addr[n_lan_addr].addr.s_addr);
 		if (lan_addr[n_lan_addr].snotify >= 0)
 		{
-			SendSSDPNotifies(lan_addr[n_lan_addr].snotify, lan_addr[n_lan_addr].str,
-				runtime_vars.port, runtime_vars.notify_interval);
+			if (notify)
+				SendSSDPNotifies(lan_addr[n_lan_addr].snotify, lan_addr[n_lan_addr].str,
+					runtime_vars.port, runtime_vars.notify_interval);
 			n_lan_addr++;
 		}
 		if (ifname || n_lan_addr >= MAX_LAN_ADDR)
@@ -153,8 +154,9 @@
 		lan_addr[n_lan_addr].snotify = OpenAndConfSSDPNotifySocket(lan_addr[i].addr.s_addr);
 		if (lan_addr[n_lan_addr].snotify >= 0)
 		{
-			SendSSDPNotifies(lan_addr[n_lan_addr].snotify, lan_addr[n_lan_addr].str,
-				runtime_vars.port, runtime_vars.notify_interval);
+			if (notify)
+				SendSSDPNotifies(lan_addr[n_lan_addr].snotify, lan_addr[n_lan_addr].str,
+					runtime_vars.port, runtime_vars.notify_interval);
 			n_lan_addr++;
 		}
 		if (ifname || n_lan_addr >= MAX_LAN_ADDR)
@@ -299,7 +301,7 @@
 }
 
 void
-reload_ifaces(void)
+reload_ifaces(int notify)
 {
 	int i;
 
@@ -313,11 +315,11 @@
 	{
 		for (i = 0; runtime_vars.ifaces[i]; i++)
 		{
-			getifaddr(runtime_vars.ifaces[i]);
+			getifaddr(runtime_vars.ifaces[i], notify);
 		}
 	}
 	else
-		getifaddr(NULL);
+		getifaddr(NULL, notify);
 
 	for (i = 0; i < n_lan_addr; i++)
 	{
@@ -382,6 +384,6 @@
 		nlh = NLMSG_NEXT(nlh, len);
 	}
 	if (changed)
-		reload_ifaces();
-#endif
-}
+		reload_ifaces(1);
+#endif
+}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks