mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #11 from xiangli-cmu/master
return error when cannot join the cluster
This commit is contained in:
commit
78cb13cf19
3
etcd.go
3
etcd.go
@ -501,6 +501,9 @@ func joinCluster(s *raft.Server, serverName string) error {
|
||||
resp, err := t.Post(fmt.Sprintf("%s/join", serverName), &b)
|
||||
|
||||
for {
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to join: %v", err)
|
||||
}
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
|
@ -26,7 +26,11 @@ func (t transporter) SendAppendEntriesRequest(server *raft.Server, peer *raft.Pe
|
||||
|
||||
debug("Send LogEntries to %s ", peer.Name())
|
||||
|
||||
resp, _ := t.Post(fmt.Sprintf("%s/log/append", peer.Name()), &b)
|
||||
resp, err := t.Post(fmt.Sprintf("%s/log/append", peer.Name()), &b)
|
||||
|
||||
if err != nil {
|
||||
debug("Cannot send AppendEntriesRequest to %s : %s", peer.Name(), err)
|
||||
}
|
||||
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
@ -47,7 +51,11 @@ func (t transporter) SendVoteRequest(server *raft.Server, peer *raft.Peer, req *
|
||||
|
||||
debug("Send Vote to %s", peer.Name())
|
||||
|
||||
resp, _ := t.Post(fmt.Sprintf("%s/vote", peer.Name()), &b)
|
||||
resp, err := t.Post(fmt.Sprintf("%s/vote", peer.Name()), &b)
|
||||
|
||||
if err != nil {
|
||||
debug("Cannot send VoteRequest to %s : %s", peer.Name(), err)
|
||||
}
|
||||
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user