瀏覽代碼

fix cow host list

Chris Bannister 10 年之前
父節點
當前提交
35a8da1daa
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      policies.go

+ 2 - 1
policies.go

@@ -38,7 +38,7 @@ func (c *cowHostList) add(host HostInfo) {
 	l := c.get()
 
 	if n := len(l); n == 0 {
-		l = append(l, host)
+		l = []HostInfo{host}
 	} else {
 		newL := make([]HostInfo, n+1)
 		for i := 0; i < n; i++ {
@@ -49,6 +49,7 @@ func (c *cowHostList) add(host HostInfo) {
 			newL[i] = l[i]
 		}
 		newL[n] = host
+		l = newL
 	}
 
 	c.list.Store(&l)