From 2eda27e9f4ded90d1ae2ac8065c7493b985a4537 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 10 Jul 2013 16:25:37 -0700 Subject: [PATCH 1/2] return error when cannot join the cluster --- etcd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etcd.go b/etcd.go index 5bd110a77c1..9b4d23f3200 100644 --- a/etcd.go +++ b/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 { From 931afb93949b75209ad891102239fc973df98c4b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 10 Jul 2013 17:49:32 -0700 Subject: [PATCH 2/2] report network problem --- transporter.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/transporter.go b/transporter.go index 8d71b585a83..0eb6c5599e0 100644 --- a/transporter.go +++ b/transporter.go @@ -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()