Lines Matching refs:host

41 #include "mail-host.h"
43 #include "director-host.h"
73 mark the host as failed so we won't try to reconnect to it immediately */
116 /* for incoming connections the director host isn't known until
118 struct director_host *host;
172 if (conn->host != NULL)
173 conn->host->last_protocol_failure = ioloop_time;
270 struct director_host *host)
278 host->ip_str, host->port);
285 conn->connect_request_to = host;
317 if (conn->host->self) {
322 } else if (dir->left->host == conn->host) {
324 dir->left->host->name, conn->host->name);
326 "Replacing with %s", conn->host->name));
334 } else if (director_host_cmp_to_self(dir->left->host, conn->host,
338 director_connection_send_connect(conn, dir->left->host);
350 conn->name = i_strdup_printf("%s/left", conn->host->name);
415 if (director_host_cmp_to_self(conn->host, dir->right->host,
420 conn->host->name, dir->right->host->name);
425 dir->right->host->name, conn->host->name);
427 "Replacing with %s", conn->host->name));
431 conn->name = i_strdup_printf("%s/right", conn->host->name);
473 if (!conn->in && (!net_ip_compare(&conn->host->ip, &ip) ||
474 conn->host->port != port)) {
477 conn->host->ip_str, conn->host->port,
527 i_assert(conn->host == NULL);
528 conn->host = director_host_get(dir, &ip, port);
529 /* the host shouldn't be removed at this point, but if for some
531 conn->host->removed = FALSE;
532 director_host_ref(conn->host);
534 director_host_restarted(conn->host);
536 next_comm_attempt = conn->host->last_protocol_failure +
548 conn->host->last_network_failure = 0;
551 } else if (dir->left->host == conn->host) {
556 } else if (director_host_cmp_to_self(conn->host, dir->left->host,
560 conn->host->ip_str,
561 conn->host->port);
597 unsigned int username_hash, struct mail_host *host,
604 struct user_directory *users = host->tag->users;
625 host, timestamp);
651 username_hash, host->ip_str,
652 user->host->ip_str);
653 host = user->host;
655 } else if (user->host == host) {
656 /* update to the same host */
658 /* host conflict for a user that is already near expiring. we can
660 and we should have as well. use the new host. */
662 "replacing host %s with %s", username_hash,
663 user->host->ip_str, host->ip_str);
666 /* user is still being moved - ignore conflicting host updates
669 "preserve its host %s instead of replacing with %s",
670 username_hash, user->host->ip_str, host->ip_str);
671 host = user->host;
674 conflicting host. this shouldn't happen. */
679 username_hash, user->host->ip_str, host->ip_str);
698 if (net_ip_cmp(&user->host->ip, &host->ip) > 0) {
699 /* change the host. we'll also need to remove the user
700 from the old host's user_count, because we can't
701 keep track of the user for more than one host.
706 /* keep the host */
707 host = user->host;
713 username_hash, &host->ip);
716 if (user->host != host) {
717 user->host->user_count--;
718 user->host = host;
719 user->host->user_count++;
758 struct mail_host *host;
772 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
773 if (host == NULL) {
774 i_error("director(%s): USER used unknown host %s in handshake",
786 if (director_user_refresh(conn, username_hash, host,
820 struct mail_host *host;
837 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
838 if (host == NULL) {
839 /* we probably just removed this host. */
844 host, timestamp, FALSE, &forced, &user) > 0) {
847 forced ? conn->dir->self_host : conn->host;
857 struct director_host *host;
865 host = director_host_lookup(conn->dir, &ip, port);
866 if (host != NULL) {
867 if (host == conn->dir->self_host) {
871 if (host->removed) {
882 host->last_network_failure = 0;
884 director_host_restarted(host);
887 host = director_host_add(conn->dir, &ip, port);
892 guarantee that it gets seen by everyone. resetting the host multiple
898 director_host_cmp_to_self(host, conn->dir->right->host,
900 dir_debug("Received DIRECTOR update for a host where we should be connected to. "
903 director_notify_ring_added(host,
912 struct director_host *host;
919 host = director_host_lookup(conn->dir, &ip, port);
920 if (host != NULL && !host->removed)
921 director_ring_remove(host, director_connection_get_host(conn));
969 struct director_host *host;
981 host = director_host_lookup(conn->dir, &ip, port);
982 if (host == NULL || host->removed) {
988 *host_r = host;
989 if (seq <= host->last_seq) {
993 host->last_seq = seq;
1015 struct mail_host *host;
1017 struct director_host *src_host = conn->host;
1036 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
1037 if (host == NULL) {
1038 /* we probably just removed this host. */
1069 host, ioloop_time, weak, &forced, &user);
1092 struct director_host *src_host = conn->host;
1093 struct mail_host *host;
1126 director_cmd_error(conn, "Received a host tag from older director version with incompatible tagging support");
1130 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
1131 if (host == NULL) {
1132 host = mail_host_add_hostname(conn->dir->mail_hosts,
1136 update = host->vhost_count != vhost_count ||
1137 host->down != down;
1139 host_tag = mail_host_get_tag(host);
1142 conn->name, host->ip_str,
1144 mail_host_set_tag(host, tag);
1147 if (update && host->desynced) {
1151 conn->name, host->ip_str);
1152 if (host->down != down &&
1153 host->last_updown_change > last_updown_change) {
1154 /* our host has a newer change. preserve it. */
1155 down = host->down;
1157 if (host->down != down) {
1158 if (host->down)
1163 if (host->vhost_count != vhost_count) {
1164 if (host->down != down)
1167 host->vhost_count, vhost_count);
1171 vhost_count = I_MIN(vhost_count, host->vhost_count);
1173 host->last_updown_change);
1187 mail_host_set_down(host, down, last_updown_change, log_prefix);
1188 mail_host_set_vhost_count(host, vhost_count, log_prefix);
1189 director_update_host(conn->dir, src_host, dir_host, host);
1191 dir_debug("Ignoring host %s update vhost_count=%u "
1223 struct mail_host *host;
1236 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
1237 if (host != NULL)
1238 director_remove_host(conn->dir, conn->host, dir_host, host);
1247 struct mail_host *host;
1260 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
1261 if (host != NULL)
1262 director_flush_host(conn->dir, conn->host, dir_host, host);
1271 struct mail_host *host;
1286 host = mail_host_lookup(conn->dir->mail_hosts, &ip);
1287 if (host != NULL) {
1288 director_move_user(conn->dir, conn->host, dir_host,
1289 username_hash, host);
1309 director_kick_user(conn->dir, conn->host, dir_host, args[0]);
1328 director_kick_user_alt(conn->dir, conn->host, dir_host, args[0], args[1]);
1351 director_kick_user_hash(conn->dir, conn->host, dir_host,
1397 director_user_killed_everywhere(conn->dir, conn->host,
1424 /* the host is up now, make sure we can connect to it immediately
1426 conn->host->last_network_failure = 0;
1437 conn->host->ip_str,
1438 conn->host->port));
1522 director_cmd_error(conn, "Unexpected command during host list");
1550 struct director_host *host,
1561 if (host->self) {
1598 if (seq < host->last_sync_seq &&
1599 timestamp < host->last_sync_timestamp +
1604 host->name, seq, host->last_sync_seq,
1607 } else if (seq < host->last_sync_seq) {
1610 host->name, host->last_sync_seq,
1611 host->last_sync_timestamp, seq, timestamp);
1612 host->last_sync_seq = seq;
1613 host->last_sync_timestamp = timestamp;
1614 host->last_sync_seq_counter = 1;
1615 } else if (seq > host->last_sync_seq ||
1616 timestamp > host->last_sync_timestamp) {
1617 host->last_sync_seq = seq;
1618 host->last_sync_timestamp = timestamp;
1619 host->last_sync_seq_counter = 1;
1622 host->name, host->last_sync_seq,
1623 host->last_sync_timestamp, seq, timestamp);
1624 } else if (++host->last_sync_seq_counter >
1629 host->last_sync_seq_counter, host->name, seq,
1630 timestamp, host->last_sync_timestamp);
1636 if (host->desynced_hosts_hash != hosts_hash) {
1639 host->ip_str, seq, hosts_hash,
1641 host->desynced_hosts_hash = hosts_hash;
1650 conn->name, host->ip_str, seq,
1655 host->desynced_hosts_hash = 0;
1658 director_sync_send(dir, host, seq, minor_version,
1663 host->delayed_sync_seq = seq;
1664 host->delayed_sync_minor_version = minor_version;
1665 host->delayed_sync_timestamp = timestamp;
1666 host->delayed_sync_hosts_hash = hosts_hash;
1676 struct director_host *host;
1704 host = director_host_lookup(dir, &ip, port);
1705 if (host != NULL) {
1706 if (!director_connection_sync_host(conn, host, seq,
1718 if ((host == NULL || !host->self) &&
1754 struct director_host *host;
1765 host = director_host_get(conn->dir, &ip, port);
1769 director_host_cmp_to_self(host, dir->right->host,
1773 host->name, dir->right->name);
1777 if (host->removed) {
1779 host->name);
1785 host->last_network_failure = 0;
1787 host->removed = FALSE;
1805 (void)director_connect_host(dir, host, t_strdup_printf(
1820 director_host_cmp_to_self(dir->left->host, conn->host,
1822 director_connection_send_connect(conn, dir->left->host);
2133 struct mail_host *host = *hostp;
2134 const char *host_tag = mail_host_get_tag(host);
2137 host->ip_str, host->vhost_count);
2143 str_printfa(str, "\t%c%ld\t", host->down ? 'D' : 'U',
2144 (long)host->last_updown_change);
2145 if (host->hostname != NULL)
2146 str_append_tabescaped(str, host->hostname);
2195 str_append(str, user->host->ip_str);
2372 struct director_host *host)
2376 i_assert(!host->removed);
2379 director_host_restarted(host);
2382 conn->name = i_strdup_printf("%s/out", host->name);
2383 conn->host = host;
2384 director_host_ref(host);
2403 if (conn->host != NULL) {
2405 conn->host->name, remote_reason);
2467 if (conn->host != NULL)
2468 director_host_unref(conn->host);
2484 conn->host != NULL) {
2487 conn->host->last_network_failure = ioloop_time;
2617 return conn->host;