diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 47038a6..485ca64 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -60,7 +60,7 @@ }, { "ImportPath": "github.com/siddontang/goredis", - "Rev": "6d2857b0488d1e8b9f96b46802eacb68e29fb003" + "Rev": "41bbdaa8d2015389bfa495ee4e7ee4d150376751" }, { "ImportPath": "github.com/siddontang/rdb", diff --git a/Godeps/_workspace/src/github.com/siddontang/goredis/client.go b/Godeps/_workspace/src/github.com/siddontang/goredis/client.go index e535fea..f5ba26d 100644 --- a/Godeps/_workspace/src/github.com/siddontang/goredis/client.go +++ b/Godeps/_workspace/src/github.com/siddontang/goredis/client.go @@ -13,6 +13,10 @@ type PoolConn struct { } func (c *PoolConn) Close() { + if c.Conn.closed { + return + } + c.c.put(c.Conn) } diff --git a/Godeps/_workspace/src/github.com/siddontang/goredis/conn.go b/Godeps/_workspace/src/github.com/siddontang/goredis/conn.go index a13d620..864c472 100644 --- a/Godeps/_workspace/src/github.com/siddontang/goredis/conn.go +++ b/Godeps/_workspace/src/github.com/siddontang/goredis/conn.go @@ -37,6 +37,8 @@ type Conn struct { totalReadSize sizeWriter totalWriteSize sizeWriter + + closed bool } func Connect(addr string) (*Conn, error) { @@ -55,11 +57,18 @@ func ConnectWithSize(addr string, readSize int, writeSize int) (*Conn, error) { c.br = bufio.NewReaderSize(io.TeeReader(c.c, &c.totalReadSize), readSize) c.bw = bufio.NewWriterSize(io.MultiWriter(c.c, &c.totalWriteSize), writeSize) + c.closed = false + return c, nil } func (c *Conn) Close() { + if c.closed { + return + } + c.c.Close() + c.closed = true } func (c *Conn) GetTotalReadSize() int64 {