From a870a0bf0bef449bd478582b3721e0b562faf7a2 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Sun, 27 Aug 2023 10:27:33 -0700 Subject: [PATCH] More log improvements --- server/connection.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/connection.go b/server/connection.go index 615bbb4..03a7f5c 100644 --- a/server/connection.go +++ b/server/connection.go @@ -160,7 +160,8 @@ func (c *Connection) Take() *Connection { return c } - c.pool.Errorf("Tried to Take invalid connection (%s) from idle buffer pool %s", c.status, c.pool.id) + // This happens once in a while, and is not a real error condition. + c.pool.Errorf("Tried to Take() invalid connection (%s) from idle buffer pool %s", c.status, c.pool.id) return nil } @@ -173,7 +174,8 @@ func (c *Connection) Give() { defer c.lock.Unlock() if c.status == Closed { - c.pool.Errorf("Tried to Give closed connection to idle buffer pool %s", c.pool.id) + // This happening, is actually a bug... + c.pool.Errorf("Tried to Give() closed connection to idle buffer pool %s", c.pool.id) return } @@ -206,7 +208,8 @@ func (c *Connection) close(reason string) { return } - c.pool.Printf("Closing connection from %s [%s] (reason: %s)", c.pool.id, c.sock.RemoteAddr(), reason) + c.pool.Printf("Closing connection from %s [%s], connected: %s, requests: %d, reason: %s", + c.pool.id, c.sock.RemoteAddr(), time.Since(c.connected).Round(time.Second), c.requests, reason) // Unlock a possible wild read() message. close(c.nextResponse) // Close the underlying TCP connection.