This can help with debugging problems.
struct director_host *host;
struct ip_addr ip;
in_port_t port;
+ bool log_add = FALSE;
if (!director_args_parse_ip_port(conn, args, &ip, &port))
return FALSE;
} else {
/* save the director and forward it */
host = director_host_add(conn->dir, &ip, port);
+ log_add = TRUE;
}
/* just forward this to the entire ring until it reaches back to
itself. some hosts may see this twice, but that's the only way to
"Not forwarding it since it's probably crashed.");
} else {
director_notify_ring_added(host,
- director_connection_get_host(conn));
+ director_connection_get_host(conn), log_add);
}
return TRUE;
}
}
void director_notify_ring_added(struct director_host *added_host,
- struct director_host *src)
+ struct director_host *src, bool log)
{
const char *cmd;
+ if (log) {
+ i_info("Adding director %s to ring (requested by %s)",
+ added_host->name, src->name);
+ }
+
added_host->dir->ring_change_counter++;
cmd = t_strdup_printf("DIRECTOR\t%s\t%u\n",
net_ip2addr(&added_host->ip), added_host->port);
unsigned int i, count;
const char *cmd;
+ i_info("Removing director %s from ring (requested by %s)",
+ removed_host->name, src->name);
+
if (removed_host->self) {
/* others will just disconnect us */
return;
bool director_resend_sync(struct director *dir);
void director_notify_ring_added(struct director_host *added_host,
- struct director_host *src);
+ struct director_host *src, bool log);
void director_ring_remove(struct director_host *removed_host,
struct director_host *src);
if (director_host_lookup(conn->dir, &ip, port) == NULL) {
host = director_host_add(conn->dir, &ip, port);
- director_notify_ring_added(host, conn->dir->self_host);
+ director_notify_ring_added(host, conn->dir->self_host, TRUE);
}
o_stream_nsend(conn->output, "OK\n", 3);
return DOVEADM_DIRECTOR_CMD_RET_OK;