update godep

This commit is contained in:
siddontang 2015-03-16 11:35:59 +08:00
parent e59300c5b2
commit 0e2f2569a0
3 changed files with 14 additions and 1 deletions

2
Godeps/Godeps.json generated
View File

@ -60,7 +60,7 @@
}, },
{ {
"ImportPath": "github.com/siddontang/goredis", "ImportPath": "github.com/siddontang/goredis",
"Rev": "6d2857b0488d1e8b9f96b46802eacb68e29fb003" "Rev": "41bbdaa8d2015389bfa495ee4e7ee4d150376751"
}, },
{ {
"ImportPath": "github.com/siddontang/rdb", "ImportPath": "github.com/siddontang/rdb",

View File

@ -13,6 +13,10 @@ type PoolConn struct {
} }
func (c *PoolConn) Close() { func (c *PoolConn) Close() {
if c.Conn.closed {
return
}
c.c.put(c.Conn) c.c.put(c.Conn)
} }

View File

@ -37,6 +37,8 @@ type Conn struct {
totalReadSize sizeWriter totalReadSize sizeWriter
totalWriteSize sizeWriter totalWriteSize sizeWriter
closed bool
} }
func Connect(addr string) (*Conn, error) { 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.br = bufio.NewReaderSize(io.TeeReader(c.c, &c.totalReadSize), readSize)
c.bw = bufio.NewWriterSize(io.MultiWriter(c.c, &c.totalWriteSize), writeSize) c.bw = bufio.NewWriterSize(io.MultiWriter(c.c, &c.totalWriteSize), writeSize)
c.closed = false
return c, nil return c, nil
} }
func (c *Conn) Close() { func (c *Conn) Close() {
if c.closed {
return
}
c.c.Close() c.c.Close()
c.closed = true
} }
func (c *Conn) GetTotalReadSize() int64 { func (c *Conn) GetTotalReadSize() int64 {