Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

close the connection with better accouting

Chris Lu5e8bb8699514
diff --git a/weed/util/net_timeout.go b/weed/util/net_timeout.go
index edbb1a3b77..f057a8f5b6 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) {