Permalink
Browse files

Merge pull request #5 from jgrahamc/master

Fixed a bug where a bad connection gets reused
  • Loading branch information...
2 parents 8f3468c + b198fc8 commit 66c15b06fea42e943de7cc69c83eb119858567bd @bradfitz committed Dec 19, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 memcache/memcache.go
@@ -183,6 +183,8 @@ func (cn *conn) extendDeadline() {
func (cn *conn) condRelease(err *error) {
if *err == nil || resumableError(*err) {
cn.release()
+ } else {
+ cn.nc.Close()
}
}
@@ -289,7 +291,7 @@ func (c *Client) onItem(item *Item, fn func(*Client, *bufio.ReadWriter, *Item) e
return err
}
defer cn.condRelease(&err)
- if err := fn(c, cn.rw, item); err != nil {
+ if err = fn(c, cn.rw, item); err != nil {
return err
}
return nil

0 comments on commit 66c15b0

Please sign in to comment.