etcdserver: not add self to transporter based on local ID

If this is decided by local name, it comes to trouble if the name is
duplicate in the cluster.
This commit is contained in:
Yicheng Qin 2015-01-29 11:36:26 -08:00
parent d0af96d558
commit 7840d49ae0

View File

@ -253,7 +253,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
tr := rafthttp.NewTransporter(cfg.Transport, id, cfg.Cluster.ID(), srv, srv.errorc, sstats, lstats)
// add all the remote members into sendhub
for _, m := range cfg.Cluster.Members() {
if m.Name != cfg.Name {
if m.ID != id {
tr.AddPeer(m.ID, m.PeerURLs)
}
}