diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-20 02:53:50 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-20 02:53:50 -0700 |
| commit | 5e8bb86995145d31fbde233b02f749d59680d45c (patch) | |
| tree | cec4d86aeb7c93b3d2490f0e4be859daeb622a9f | |
| parent | 978da73cdb651c8f3b95dfe38e60f49772c4db0b (diff) | |
| download | seaweedfs-5e8bb86995145d31fbde233b02f749d59680d45c.tar.xz seaweedfs-5e8bb86995145d31fbde233b02f749d59680d45c.zip | |
close the connection with better accouting
| -rw-r--r-- | weed/util/net_timeout.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/weed/util/net_timeout.go b/weed/util/net_timeout.go index edbb1a3b7..f057a8f5b 100644 --- a/weed/util/net_timeout.go +++ b/weed/util/net_timeout.go @@ -67,11 +67,14 @@ func (c *Conn) Write(b []byte) (count int, e error) { } func (c *Conn) Close() error { - if !c.isClosed { - stats.ConnectionClose() - c.isClosed = true + err := c.Conn.Close() + if err == nil { + if !c.isClosed { + stats.ConnectionClose() + c.isClosed = true + } } - return c.Conn.Close() + return err } func NewListener(addr string, timeout time.Duration) (net.Listener, error) { |
