Mercurial > dovecot > core-2.2
comparison src/director/director-connection.c @ 16789:5d43c926eb97
director: Make sure director restart notifications go to everyone in the ring.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 20 Sep 2013 10:35:34 +0300 |
parents | b78c705bbb8d |
children | c30453a58b4c |
comparison
equal
deleted
inserted
replaced
16788:b78c705bbb8d | 16789:5d43c926eb97 |
---|---|
623 const char *const *args) | 623 const char *const *args) |
624 { | 624 { |
625 struct director_host *host; | 625 struct director_host *host; |
626 struct ip_addr ip; | 626 struct ip_addr ip; |
627 unsigned int port; | 627 unsigned int port; |
628 bool forward = FALSE; | |
629 | 628 |
630 if (!director_args_parse_ip_port(conn, args, &ip, &port)) | 629 if (!director_args_parse_ip_port(conn, args, &ip, &port)) |
631 return FALSE; | 630 return FALSE; |
632 | 631 |
633 host = director_host_lookup(conn->dir, &ip, port); | 632 host = director_host_lookup(conn->dir, &ip, port); |
642 } | 641 } |
643 | 642 |
644 /* already have this. just reset its last_network_failure | 643 /* already have this. just reset its last_network_failure |
645 timestamp, since it might be up now. */ | 644 timestamp, since it might be up now. */ |
646 host->last_network_failure = 0; | 645 host->last_network_failure = 0; |
647 if (host->last_seq != 0 || host->last_sync_seq != 0) { | 646 /* it also may have been restarted, reset its state */ |
648 /* it also may have been restarted, reset its state */ | 647 director_host_restarted(host); |
649 director_host_restarted(host); | |
650 forward = TRUE; | |
651 } | |
652 } else { | 648 } else { |
653 /* save the director and forward it */ | 649 /* save the director and forward it */ |
654 host = director_host_add(conn->dir, &ip, port); | 650 host = director_host_add(conn->dir, &ip, port); |
655 forward = TRUE; | 651 } |
656 } | 652 /* just forward this to the entire ring until it reaches back to |
657 if (forward) { | 653 itself. some hosts may see this twice, but that's the only way to |
658 director_notify_ring_added(host, | 654 guarantee that it gets seen by everyone. reseting the host multiple |
659 director_connection_get_host(conn)); | 655 times may cause us to handle its commands multiple times, but the |
660 } | 656 commands can handle that. */ |
657 director_notify_ring_added(host, director_connection_get_host(conn)); | |
661 return TRUE; | 658 return TRUE; |
662 } | 659 } |
663 | 660 |
664 static bool director_cmd_director_remove(struct director_connection *conn, | 661 static bool director_cmd_director_remove(struct director_connection *conn, |
665 const char *const *args) | 662 const char *const *args) |