Skip to content

Commit c7a97f7

Browse files
blink-so[bot]f0ssel
andcommitted
Remove connection deadlines to allow long-lived connections
Connections need to stay open indefinitely for valid use cases. The errgroup synchronization alone is sufficient to prevent goroutine leaks. Co-authored-by: f0ssel <[email protected]>
1 parent 591b02c commit c7a97f7

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

proxy/proxy.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"strings"
1515
"sync"
1616
"sync/atomic"
17-
"time"
1817

1918
"github.com/coder/boundary/audit"
2019
"github.com/coder/boundary/rules"
@@ -661,11 +660,6 @@ func (p *Server) streamRequestToTarget(clientConn *tls.Conn, bufReader *bufio.Re
661660
}
662661
}()
663662

664-
// Set connection deadlines to prevent indefinite blocking
665-
deadline := time.Now().Add(5 * time.Minute)
666-
_ = clientConn.SetDeadline(deadline)
667-
_ = targetConn.SetDeadline(deadline)
668-
669663
// Send HTTP request headers to target
670664
reqLine := fmt.Sprintf("%s %s %s\r\n", req.Method, req.URL.RequestURI(), req.Proto)
671665
_, err = targetConn.Write([]byte(reqLine))
@@ -757,11 +751,6 @@ func (p *Server) handleConnectStreaming(tlsConn *tls.Conn, req *http.Request, ho
757751
}
758752
defer func() { _ = targetConn.Close() }()
759753

760-
// Set connection deadlines to prevent indefinite blocking
761-
deadline := time.Now().Add(5 * time.Minute)
762-
_ = tlsConn.SetDeadline(deadline)
763-
_ = targetConn.SetDeadline(deadline)
764-
765754
// Use errgroup for bidirectional copy with proper cleanup
766755
g, ctx := errgroup.WithContext(context.Background())
767756

0 commit comments

Comments
 (0)