mirror of
https://github.com/renorris/openfsd
synced 2026-04-17 07:45:31 +08:00
add client timeout via net/Conn SetDeadline
This commit is contained in:
@@ -35,9 +35,11 @@ func (s *Server) handleConn(ctx context.Context, conn net.Conn) {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
defer conn.Close()
|
||||
|
||||
// Set timeout for login phase
|
||||
conn.SetDeadline(getTimeBySecondsInFuture(s.cfg.ConnectionTimeoutSeconds))
|
||||
|
||||
if err := sendServerIdent(conn); err != nil {
|
||||
fmt.Printf("Error sending server ident: %v\n", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user