Browse Source

Close connections that are being discarded

If a TCP connection to memcache is not being returned to the free list (because an error
has occurred on the connection and its reuse is not allowed), explicitly close the
connection.
John Graham-Cumming 13 năm trước cách đây
mục cha
commit
b198fc8c17
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      memcache/memcache.go

+ 2 - 0
memcache/memcache.go

@@ -183,6 +183,8 @@ func (cn *conn) extendDeadline() {
 func (cn *conn) condRelease(err *error) {
 func (cn *conn) condRelease(err *error) {
 	if *err == nil || resumableError(*err) {
 	if *err == nil || resumableError(*err) {
 		cn.release()
 		cn.release()
+	} else {
+		cn.nc.Close()
 	}
 	}
 }
 }