1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-03 23:56:41 +02:00

close the connection with better accouting

This commit is contained in:
Chris Lu 2020-04-20 02:53:50 -07:00
parent 978da73cdb
commit 5e8bb86995

View file

@ -67,11 +67,14 @@ func (c *Conn) Write(b []byte) (count int, e error) {
} }
func (c *Conn) Close() error { func (c *Conn) Close() error {
if !c.isClosed { err := c.Conn.Close()
stats.ConnectionClose() if err == nil {
c.isClosed = true if !c.isClosed {
stats.ConnectionClose()
c.isClosed = true
}
} }
return c.Conn.Close() return err
} }
func NewListener(addr string, timeout time.Duration) (net.Listener, error) { func NewListener(addr string, timeout time.Duration) (net.Listener, error) {