changeset 22641:7163028a9f90

director: Add mail_host.ip_str This avoids having to use net_ip2addr() all the time to convert it into a string.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 04 Nov 2017 01:49:29 +0200
parents cf23a90cd2ca
children 36e4e7fc0b1b
files src/director/mail-host.c src/director/mail-host.h
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/mail-host.c	Sat Nov 04 01:48:41 2017 +0200
+++ b/src/director/mail-host.c	Sat Nov 04 01:49:29 2017 +0200
@@ -194,6 +194,7 @@
 	host->list = list;
 	host->vhost_count = VHOST_MULTIPLIER;
 	host->ip = *ip;
+	host->ip_str = i_strdup(net_ip2addr(ip));
 	host->tag = mail_tag_get(list, tag_name);
 	array_append(&list->hosts, &host, 1);
 
@@ -391,6 +392,7 @@
 static void mail_host_free(struct mail_host *host)
 {
 	i_free(host->hostname);
+	i_free(host->ip_str);
 	i_free(host);
 }
 
@@ -566,6 +568,7 @@
 	dest = i_new(struct mail_host, 1);
 	*dest = *src;
 	dest->tag = mail_tag_get(dest_list, src->tag->name);
+	dest->ip_str = i_strdup(src->ip_str);
 	dest->hostname = i_strdup(src->hostname);
 	return dest;
 }
--- a/src/director/mail-host.h	Sat Nov 04 01:48:41 2017 +0200
+++ b/src/director/mail-host.h	Sat Nov 04 01:49:29 2017 +0200
@@ -33,6 +33,7 @@
 	time_t last_updown_change;
 
 	struct ip_addr ip;
+	char *ip_str;
 	char *hostname;
 	struct mail_tag *tag;