Skip to content

Commit

Permalink
add SetReadHeaderTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzihui authored and pires committed Oct 8, 2024
1 parent b718e7c commit 21542e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ func ValidateHeader(v Validator) func(*Conn) {
}
}

// SetReadHeaderTimeout sets the readHeaderTimeout for a connection when passed as option to NewConn()
func SetReadHeaderTimeout(t time.Duration) func(*Conn) {
return func(c *Conn) {
if t >= 0 {
c.readHeaderTimeout = t
}
}
}

// Accept waits for and returns the next connection to the listener.
func (p *Listener) Accept() (net.Conn, error) {
// Get the underlying connection
Expand Down

0 comments on commit 21542e2

Please sign in to comment.