Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-09-09 16:03:38 +02:00
parent de1866c23a
commit 3a03b83496
2 changed files with 3 additions and 12 deletions
+2 -12
View File
@@ -95,6 +95,8 @@ func (ph *proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Debugf("WebSocket proxy established: %s -> gRPC handler", r.RemoteAddr)
(&http2.Server{
// TODO (dmitri) we should limit the number of concurrent streams per connection (peer)
// and idle timeouts
// MaxConcurrentStreams: 20,
// IdleTimeout: 60 * time.Second,
}).ServeConn(serverConn, &http2.ServeConnOpts{
@@ -107,16 +109,4 @@ func (ph *proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
})
log.Debugf("WebSocket proxy closing: %s -> gRPC handler", r.RemoteAddr)
// p.proxyData(ctx, wsConn, clientConn, r.RemoteAddr)
}
type timeoutResettingHandler struct {
wrappedHandler http.Handler
}
func (th *timeoutResettingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// ctrl := http.NewResponseController(w)
// ctrl.SetReadDeadline(time.Time{})
th.wrappedHandler.ServeHTTP(w, r)
}
+1
View File
@@ -74,6 +74,7 @@ func (ws *wsConnAdapter) Read(b []byte) (int, error) {
func (ws *wsConnAdapter) readFromBuffer(b []byte) (int, error) {
n := copy(b, ws.bufferedRead)
// check if we started receiving data, stop the header read timeout timer
if ws.isFramerActive() {
_, _ = ws.frameBuffer.Write(b) // we don't care about the number of bytes copied and no errors are returned from Write
if frame, err := ws.framer.ReadFrame(); err != nil && frame != nil && frame.Header().Type == http2.FrameData {