mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-13 18:29:07 +02:00
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user