Browse Source

bump(github.com/coreos/go-etcd): 460022c1238ee0913013936e3486f41a3c7c1d7a

Brandon Philips 12 years ago
parent
commit
13afdb0825
1 changed files with 8 additions and 0 deletions
  1. 8 0
      third_party/github.com/coreos/go-etcd/etcd/client.go

+ 8 - 0
third_party/github.com/coreos/go-etcd/etcd/client.go

@@ -123,12 +123,19 @@ func (c *Client) internalSyncCluster(machines []string) bool {
 			continue
 		} else {
 			b, err := ioutil.ReadAll(resp.Body)
+			resp.Body.Close()
 			if err != nil {
 				// try another machine in the cluster
 				continue
 			}
 			// update Machines List
 			c.cluster.Machines = strings.Split(string(b), ",")
+
+			// update leader
+			// the first one in the machine list is the leader
+			logger.Debugf("update.leader[%s,%s]", c.cluster.Leader, c.cluster.Machines[0])
+			c.cluster.Leader = c.cluster.Machines[0]
+
 			logger.Debug("sync.machines ", c.cluster.Machines)
 			return true
 		}
@@ -139,6 +146,7 @@ func (c *Client) internalSyncCluster(machines []string) bool {
 // serverName should contain both hostName and port
 func (c *Client) createHttpPath(serverName string, _path string) string {
 	httpPath := path.Join(serverName, _path)
+	httpPath = c.config.Scheme + "://" + httpPath
 	return httpPath
 }