Skip to content

Commit

Permalink
More log improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Aug 27, 2023
1 parent 91322fb commit a870a0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a870a0b

Please sign in to comment.