PING a quiet IRC listener client before closing it (closes #155)
check / check (push) Canceled after 0s
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user