mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
parser: greatly simplify reply parsing.
This commit is contained in:
11
redis.go
11
redis.go
@ -2,16 +2,11 @@ package redis
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrReaderTooSmall = errors.New("redis: Reader is too small")
|
||||
)
|
||||
|
||||
type OpenConnFunc func() (io.ReadWriteCloser, error)
|
||||
type CloseConnFunc func(io.ReadWriteCloser) error
|
||||
type InitConnFunc func(*Client) error
|
||||
@ -110,7 +105,11 @@ func (c *BaseClient) Run(req Req) {
|
||||
|
||||
val, err := req.ParseReply(conn.Rd)
|
||||
if err != nil {
|
||||
c.ConnPool.Add(conn)
|
||||
if err == Nil {
|
||||
c.ConnPool.Add(conn)
|
||||
} else {
|
||||
c.ConnPool.Remove(conn)
|
||||
}
|
||||
req.SetErr(err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user