瀏覽代碼

close resp body, close snapshot

Xiang Li 12 年之前
父節點
當前提交
6edce10980
共有 2 個文件被更改,包括 2 次插入3 次删除
  1. 1 1
      etcd.go
  2. 1 2
      util.go

+ 1 - 1
etcd.go

@@ -212,7 +212,7 @@ func main() {
 	}
 
 	// open the snapshot
-	go server.Snapshot()
+	//go server.Snapshot()
 
 	if webPort != -1 {
 		// start web

+ 1 - 2
util.go

@@ -68,9 +68,8 @@ func Get(t *transHandler, path string) (*http.Response, error) {
 func leaderClient() string {
 	resp, _ := Get(&serverTransHandler, server.Leader()+"/client")
 	if resp != nil {
-		defer resp.Body.Close()
 		body, _ := ioutil.ReadAll(resp.Body)
-
+		resp.Body.Close()
 		return string(body)
 	}
 	return ""