add client timeout via net/Conn SetDeadline

This commit is contained in:
Reese Norris
2025-07-06 17:40:11 -07:00
parent 8c49beeb8c
commit 8affb6210e
4 changed files with 14 additions and 1 deletions

View File

@@ -108,6 +108,8 @@ func (s *Server) eventLoop(client *Client) {
go client.senderWorker()
for {
// Set deadline and attempt to read
client.conn.SetReadDeadline(getTimeBySecondsInFuture(s.cfg.ConnectionTimeoutSeconds))
if !client.scanner.Scan() {
return
}