diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-20 22:41:37 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-20 22:41:37 -0700 |
| commit | 4bc19f1e523b50080fca894a469662bd704b2639 (patch) | |
| tree | 0a62c607c37ecee538e553215dd6fdc780526447 | |
| parent | e1b5ac5c042ab7e88506fde234810400a555d261 (diff) | |
| download | seaweedfs-4bc19f1e523b50080fca894a469662bd704b2639.tar.xz seaweedfs-4bc19f1e523b50080fca894a469662bd704b2639.zip | |
master: fix connections count reporting
| -rw-r--r-- | weed/util/net_timeout.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/util/net_timeout.go b/weed/util/net_timeout.go index 8acd50d42..edbb1a3b7 100644 --- a/weed/util/net_timeout.go +++ b/weed/util/net_timeout.go @@ -35,6 +35,7 @@ type Conn struct { net.Conn ReadTimeout time.Duration WriteTimeout time.Duration + isClosed bool } func (c *Conn) Read(b []byte) (count int, e error) { @@ -66,7 +67,10 @@ func (c *Conn) Write(b []byte) (count int, e error) { } func (c *Conn) Close() error { - stats.ConnectionClose() + if !c.isClosed { + stats.ConnectionClose() + c.isClosed = true + } return c.Conn.Close() } |
