Skip the initial ssdp:alive packets when initially registering our network

interfaces during startup, so the byebye's can come first.
This commit is contained in:
Justin Maggard 2013-10-22 18:50:09 -07:00
parent 2e68335430
commit c96e6e2adb
3 changed files with 14 additions and 12 deletions

View File

@ -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 @@ getifaddr(const char *ifname)
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 @@ getifaddr(const char *ifname)
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 @@ get_remote_mac(struct in_addr ip_addr, unsigned char *mac)
}
void
reload_ifaces(void)
reload_ifaces(int notify)
{
int i;
@ -313,11 +315,11 @@ reload_ifaces(void)
{
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 @@ ProcessMonitorEvent(int s)
nlh = NLMSG_NEXT(nlh, len);
}
if (changed)
reload_ifaces();
reload_ifaces(1);
#endif
}

View File

@ -40,7 +40,7 @@
int getsyshwaddr(char *buf, int len);
int get_remote_mac(struct in_addr ip_addr, unsigned char *mac);
void reload_ifaces(void);
void reload_ifaces(int notify);
int OpenAndConfMonitorSocket();
void ProcessMonitorEvent(int s);

View File

@ -169,7 +169,7 @@ sighup(int sig)
signal(sig, sighup);
DPRINTF(E_WARN, L_GENERAL, "received signal %d, re-read\n", sig);
reload_ifaces();
reload_ifaces(1);
}
/* record the startup time */
@ -904,7 +904,7 @@ init(int argc, char **argv)
}
set_startup_time();
reload_ifaces();
reload_ifaces(0);
/* presentation url */
if (presurl)