diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-11-16 01:15:46 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-11-16 01:15:46 +0000 |
commit | a3d45b39608418e261f34b3b3286b80e4878d25c (patch) | |
tree | 0743b13f2386f4e108dc8e6d17fc0d3cf18e4791 /avahi-core/iface.c | |
parent | 6ed9be1191edab688976f5ea7ddf1e382ef6f1d1 (diff) |
* when calculating a random jitter time for time events, use the same jitter in
every 10s timespans. This should increase the probability that multiple
responses can be merged into a single packet, and thus decreases network
traffic.
* add _workstation._tcp services in RUNNING state, not earlier
* an important bugfix which fixes the entry group state automatons
* remove obsolete debug messages
* minor other cleanups
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@980 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/iface.c')
-rw-r--r-- | avahi-core/iface.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 0f4d518..c96f081 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -121,8 +121,7 @@ void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) { if (m->list_complete && !remove_rrs && m->server->config.publish_workstation && - (m->server->state == AVAHI_SERVER_RUNNING || - m->server->state == AVAHI_SERVER_REGISTERING)) { + (m->server->state == AVAHI_SERVER_RUNNING)) { if (!hw->entry_group) hw->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL); @@ -131,18 +130,11 @@ void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) { return; /* OOM */ if (avahi_s_entry_group_is_empty(hw->entry_group)) { - char name[AVAHI_LABEL_MAX]; - char *t; - - if (!(t = avahi_format_mac_address(hw->mac_address, hw->mac_address_size))) - return; /* OOM */ + char name[AVAHI_LABEL_MAX], mac[256]; - snprintf(name, sizeof(name), "%s [%s]", m->server->host_name, t); - avahi_free(t); + avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size); + snprintf(name, sizeof(name), "%s [%s]", m->server->host_name, mac); - if (!name) - return; /* OOM */ - if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, 0, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) { avahi_log_warn(__FILE__": avahi_server_add_service() failed: %s", avahi_strerror(m->server->error)); avahi_s_entry_group_free(hw->entry_group); @@ -557,22 +549,15 @@ AvahiInterfaceAddress* avahi_interface_monitor_get_address(AvahiInterfaceMonitor return NULL; } - void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port) { assert(i); assert(p); -/* char t[AVAHI_ADDRESS_STR_MAX]; */ if (!avahi_interface_is_relevant(i)) return; assert(!a || a->proto == i->protocol); -/* if (a) */ -/* avahi_log_debug("unicast sending on '%s.%i' to %s:%u", i->hardware->name, i->protocol, avahi_address_snprint(t, sizeof(t), a), port); */ -/* else */ -/* avahi_log_debug("multicast sending on '%s.%i'", i->hardware->name, i->protocol); */ - if (i->protocol == AVAHI_PROTO_INET && i->monitor->server->fd_ipv4 >= 0) avahi_send_dns_packet_ipv4(i->monitor->server->fd_ipv4, i->hardware->index, p, i->mcast_joined ? &i->local_mcast_address.data.ipv4 : NULL, a ? &a->data.ipv4 : NULL, port); else if (i->protocol == AVAHI_PROTO_INET6 && i->monitor->server->fd_ipv6 >= 0) |