From: meingtsla Date: Sun, 30 Oct 2016 04:16:04 +0000 (-0700) Subject: asn_{open,close}: Always initialize ipinfo hash table X-Git-Tag: v0.94~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=993cbb8c5e4d1cf16863596bbc73433f920e53ad;p=thirdparty%2Fmtr.git asn_{open,close}: Always initialize ipinfo hash table Currently the only pathway to asn_open() is through display_open(), so hcreate() for ipinfo was only happening if -y or -z was specified at startup. The ability to toggle ipinfo display in interactive mode was introduced in commit d4bb85a80ee3eb76d803e3cd04de2ccdf0379415; however, no pathway to asn_open on a toggle event was provided. This means ipinfo results were not being stored, resulting in repeated ipinfo DNS queries being made for the same IP addresses. To fix this, always set up the hash table if there is a possibility of toggling ipinfo display. --- diff --git a/asn.c b/asn.c index bbf4180..c39a78e 100644 --- a/asn.c +++ b/asn.c @@ -278,15 +278,13 @@ extern int is_printii(struct mtr_ctl *ctl) { } extern void asn_open(struct mtr_ctl *ctl) { - if (ctl->ipinfo_no >= 0) { - DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI); - if (!(iihash = hcreate(IIHASH_HI))) - error(0, errno, "ipinfo hash"); - } + DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI); + if (!(iihash = hcreate(IIHASH_HI))) + error(0, errno, "ipinfo hash"); } extern void asn_close(struct mtr_ctl *ctl) { - if ((ctl->ipinfo_no >= 0) && iihash) { + if (iihash) { DEB_syslog(LOG_INFO, "hdestroy()"); hdestroy(); iihash = 0;