PING a quiet IRC listener client before closing it (closes #155)
check / check (push) Canceled after 0s

serve closed a connection after five minutes with nothing read and never
sent a PING, so a quiet registered client lost its session. It now sends
PING :<server> after pingInterval with nothing read, and closes the
connection when nothing is read within pongDeadline after that. Every
line read starts both waits again. readTimeout is removed.

Unregistered connections are sent the PING too, so a PONG before
registration is now ignored instead of answered with ERR_NOTREGISTERED.

Model: opus-5-5
This commit is contained in:
clawbot
2026-10-20 16:12:36 +00:00
parent 5100b9a665
commit aa56b8b63c
4 changed files with 133 additions and 3 deletions
+17
View File
@@ -64,6 +64,23 @@ const KillWriteWindow = killWriteWindow
// output queue when no broker notification arrives.
const PollInterval = pollInterval
// ServeConn serves tcpConn as s serves each connection it
// accepts, except that interval and deadline replace
// pingInterval and pongDeadline.
func (s *Server) ServeConn(
tcpConn net.Conn,
interval, deadline time.Duration,
) {
client := newConn(
context.Background(), tcpConn, s.log,
s.database, s.brk, s.cfg, s.svc,
)
client.pingInterval = interval
client.pongDeadline = deadline
go client.serve(context.Background())
}
// NewTestConn returns a Conn for nick on tcpConn, without a
// server, database or service behind it.
func NewTestConn(