File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import (
88 "time"
99)
1010
11- var DEFAULT_TIMEOUT = 200 * time .Millisecond
11+ // DefaultReadHeaderTimeout is how long header processing waits for header to
12+ // be read from the wire, if Listener.ReaderHeaderTimeout is not set.
13+ // It's kept as a global variable so to make it easier to find and override,
14+ // e.g. go build -ldflags -X "github.com/pires/go-proxyproto.DefaultReadHeaderTimeout=1s"
15+ var DefaultReadHeaderTimeout = 200 * time .Millisecond
1216
1317// Listener is used to wrap an underlying listener,
1418// whose connections may be using the HAProxy Proxy Protocol.
@@ -77,9 +81,9 @@ func (p *Listener) Accept() (net.Conn, error) {
7781 ValidateHeader (p .ValidateHeader ),
7882 )
7983
80- // If the ReadHeaderTimeout for the listener is 0, set a default of 200ms
84+ // If the ReadHeaderTimeout for the listener is unset, use the default timeout.
8185 if p .ReadHeaderTimeout == 0 {
82- p .ReadHeaderTimeout = DEFAULT_TIMEOUT
86+ p .ReadHeaderTimeout = DefaultReadHeaderTimeout
8387 }
8488
8589 // Set the readHeaderTimeout of the new conn to the value of the listener
You can’t perform that action at this time.
0 commit comments