File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ func (h *Handler) handleConnection(conn net.Conn) error {
9696
9797 scanner := bufio .NewScanner (conn )
9898
99- var startOfEOF time.Time
99+ var startOfEOF time.Time = time. Time {} // start the counter when the connection is opened so that we can track EOF wait time correctly
100100
101101 for {
102102 if ! scanner .Scan () {
@@ -107,15 +107,13 @@ func (h *Handler) handleConnection(conn net.Conn) error {
107107
108108 if startOfEOF .IsZero () {
109109 startOfEOF = time .Now ()
110- } else {
111- if time .Since (startOfEOF ) > h .maxEOFWait {
112- log .Println ("Connection timed out. Closing connection" )
113- return nil
114- }
110+ } else if time .Since (startOfEOF ) > h .maxEOFWait {
111+ log .Println ("Connection timed out. Closing connection" )
112+ return nil
115113 }
116-
117114 continue
118115 }
116+
119117 startOfEOF = time.Time {}
120118 line := scanner .Text ()
121119 if line == "" {
You can’t perform that action at this time.
0 commit comments