diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-06-25 23:12:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-06-25 23:12:26 +0200 |
commit | 037ca37a213d9e40258f5ebc3b00113df9f842d1 (patch) | |
tree | 4afc37ea2f5c75ccfd9b6377fe013956cb385531 /avahi-core | |
parent | 2f56f8a0943f92d430c8f395880ace8f5922f85b (diff) |
daemon: make internal limits configurable
Diffstat (limited to 'avahi-core')
-rw-r--r-- | avahi-core/cache.c | 7 | ||||
-rw-r--r-- | avahi-core/core.h | 1 | ||||
-rw-r--r-- | avahi-core/server.c | 3 |
3 files changed, 5 insertions, 6 deletions
diff --git a/avahi-core/cache.c b/avahi-core/cache.c index c074579..454aac5 100644 --- a/avahi-core/cache.c +++ b/avahi-core/cache.c @@ -32,8 +32,6 @@ #include "log.h" #include "rr-util.h" -#define AVAHI_CACHE_ENTRIES_MAX 500 - static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) { AvahiCacheEntry *t; @@ -340,7 +338,7 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av /* avahi_log_debug("cache: couldn't find matching cache entry for %s", txt); */ - if (c->n_entries >= AVAHI_CACHE_ENTRIES_MAX) + if (c->n_entries >= c->server->config.n_cache_entries_max) return; if (!(e = avahi_new(AvahiCacheEntry, 1))) { @@ -513,6 +511,3 @@ void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddres next_expiry(c, e, 80); } } - - - diff --git a/avahi-core/core.h b/avahi-core/core.h index 28de917..1f50126 100644 --- a/avahi-core/core.h +++ b/avahi-core/core.h @@ -65,6 +65,7 @@ typedef struct AvahiServerConfig { int allow_point_to_point; /**< Enable publishing on POINTOPOINT interfaces */ int publish_a_on_ipv6; /**< Publish an IPv4 A RR on IPv6 sockets */ int publish_aaaa_on_ipv4; /**< Publish an IPv4 A RR on IPv6 sockets */ + unsigned n_cache_entries_max; /**< Maximum number of cache entries per interface */ } AvahiServerConfig; /** Allocate a new mDNS responder object. */ diff --git a/avahi-core/server.c b/avahi-core/server.c index 6eedd6e..938c54d 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -49,6 +49,8 @@ #include "domain-util.h" #include "rr-util.h" +#define AVAHI_DEFAULT_CACHE_ENTRIES_MAX 500 + static void enum_aux_records(AvahiServer *s, AvahiInterface *i, const char *name, uint16_t type, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) { assert(s); assert(i); @@ -1583,6 +1585,7 @@ AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) { c->allow_point_to_point = 0; c->publish_aaaa_on_ipv4 = 1; c->publish_a_on_ipv6 = 0; + c->n_cache_entries_max = AVAHI_DEFAULT_CACHE_ENTRIES_MAX; return c; } |