From f8b1d48f825a12de5bc9d9777424702c8db85616 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 16 Mar 2014 13:50:46 -0700 Subject: [PATCH] deal with empty learder() cases --- go/weed/weed_server/master_server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/weed/weed_server/master_server.go b/go/weed/weed_server/master_server.go index ac28e678d..417aa81bd 100644 --- a/go/weed/weed_server/master_server.go +++ b/go/weed/weed_server/master_server.go @@ -94,8 +94,8 @@ func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Requ ms.bounedLeaderChan <- 1 defer func() { <-ms.bounedLeaderChan }() targetUrl, err := url.Parse("http://" + ms.Topo.RaftServer.Leader()) - if err != nil { - writeJsonQuiet(w, r, map[string]interface{}{"error": "Leader URL Parse Error " + err.Error()}) + if err != nil || ms.Topo.RaftServer.Leader() == "" { + writeJsonQuiet(w, r, map[string]interface{}{"error": "Leader URL http://" + ms.Topo.RaftServer.Leader() + " Parse Error " + err.Error()}) return } glog.V(4).Infoln("proxying to leader", ms.Topo.RaftServer.Leader())