From: Lennart Poettering Date: Mon, 14 Nov 2005 23:58:36 +0000 (+0000) Subject: deal better with mcast management and disappearing IP addresses X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=2fec4cc43bbc88b71484a73fa8c2911fe51b5a06;p=catta deal better with mcast management and disappearing IP addresses git-svn-id: file:///home/lennart/svn/public/avahi/trunk@965 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-core/iface.c b/avahi-core/iface.c index f639821..0f4d518 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -174,9 +174,11 @@ void avahi_interface_monitor_update_rrs(AvahiInterfaceMonitor *m, int remove_rrs static int interface_mdns_mcast_join(AvahiInterface *i, int join) { char at[AVAHI_ADDRESS_STR_MAX]; + int r; assert(i); - assert((join && !i->mcast_joined) || (!join && i->mcast_joined)); + if (!!join == !!i->mcast_joined) + return 0; if (join) { AvahiInterfaceAddress *a; @@ -207,14 +209,18 @@ static int interface_mdns_mcast_join(AvahiInterface *i, int join) { avahi_address_snprint(at, sizeof(at), &i->local_mcast_address)); if (i->protocol == AVAHI_PROTO_INET6) - avahi_mdns_mcast_join_ipv6(i->monitor->server->fd_ipv6, &i->local_mcast_address.data.ipv6, i->hardware->index, join); + r = avahi_mdns_mcast_join_ipv6(i->monitor->server->fd_ipv6, &i->local_mcast_address.data.ipv6, i->hardware->index, join); else { assert(i->protocol == AVAHI_PROTO_INET); - avahi_mdns_mcast_join_ipv4(i->monitor->server->fd_ipv4, &i->local_mcast_address.data.ipv4, i->hardware->index, join); + r = avahi_mdns_mcast_join_ipv4(i->monitor->server->fd_ipv4, &i->local_mcast_address.data.ipv4, i->hardware->index, join); } - i->mcast_joined = join; + if (r < 0) + i->mcast_joined = 0; + else + i->mcast_joined = join; + return 0; }