aboutsummaryrefslogtreecommitdiff
path: root/weed/util/net_timeout.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-09-03 00:28:58 -0700
committerChris Lu <chris.lu@gmail.com>2018-09-03 00:28:58 -0700
commit06b81c063a7926f6e2012d037a81ff584b57aed5 (patch)
tree153780094da5ebc0fd3dc58a42a1c59d5f1dfd08 /weed/util/net_timeout.go
parent88f1d32cc4a09d399966d7fa1039c1a714758e43 (diff)
downloadseaweedfs-06b81c063a7926f6e2012d037a81ff584b57aed5.tar.xz
seaweedfs-06b81c063a7926f6e2012d037a81ff584b57aed5.zip
fix possible connection counting error
Diffstat (limited to 'weed/util/net_timeout.go')
-rw-r--r--weed/util/net_timeout.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/weed/util/net_timeout.go b/weed/util/net_timeout.go
index 8acd50d42..b8068e67f 100644
--- a/weed/util/net_timeout.go
+++ b/weed/util/net_timeout.go
@@ -66,8 +66,11 @@ func (c *Conn) Write(b []byte) (count int, e error) {
}
func (c *Conn) Close() error {
- stats.ConnectionClose()
- return c.Conn.Close()
+ err := c.Conn.Close()
+ if err == nil {
+ stats.ConnectionClose()
+ }
+ return err
}
func NewListener(addr string, timeout time.Duration) (net.Listener, error) {