mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server: not create new peer if exists
This commit is contained in:
@@ -109,7 +109,9 @@ func (h *peerHub) add(id int64, rawurl string) (*peer, error) {
|
||||
if h.stopped {
|
||||
return nil, fmt.Errorf("peerHub stopped")
|
||||
}
|
||||
h.peers[id] = newPeer(u.String(), h.c)
|
||||
if _, ok := h.peers[id]; !ok {
|
||||
h.peers[id] = newPeer(u.String(), h.c)
|
||||
}
|
||||
return h.peers[id], nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user