Skip to content

Commit

Permalink
Check for syscall.EPIPE error
Browse files Browse the repository at this point in the history
  • Loading branch information
hoisie committed May 3, 2011
1 parent 0785387 commit b1466e2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ func (client *Client) openConnection() (c net.Conn, err os.Error) {


func (client *Client) sendCommand(cmd string, args ...string) (data interface{}, err os.Error) {

// grab a connection from the pool
c, err := client.popCon()

Expand All @@ -194,7 +193,7 @@ func (client *Client) sendCommand(cmd string, args ...string) (data interface{},

b := commandBytes(cmd, args...)
data, err = client.rawSend(c, b)
if err == os.EOF {
if err == os.EOF || err == os.EPIPE {
c, err = client.openConnection()
if err != nil {
goto End
Expand Down Expand Up @@ -457,7 +456,6 @@ func (client *Client) Set(key string, val []byte) os.Error {

func (client *Client) Get(key string) ([]byte, os.Error) {
res, _ := client.sendCommand("GET", key)

if res == nil {
return nil, RedisError("Key `" + key + "` does not exist")
}
Expand Down

0 comments on commit b1466e2

Please sign in to comment.