diff --git a/transport/internet/quic/hub.go b/transport/internet/quic/hub.go index f9576051..5e265ef2 100644 --- a/transport/internet/quic/hub.go +++ b/transport/internet/quic/hub.go @@ -104,8 +104,8 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti ConnectionIDLength: 12, HandshakeTimeout: time.Second * 8, IdleTimeout: time.Second * 30, - MaxIncomingStreams: 32, - MaxIncomingUniStreams: -1, + MaxIncomingStreams: 128, + MaxIncomingUniStreams: 32, } conn, err := wrapSysConn(rawConn, config) diff --git a/vendor/github.com/lucas-clemente/quic-go/send_stream.go b/vendor/github.com/lucas-clemente/quic-go/send_stream.go index f3848008..c4909f00 100644 --- a/vendor/github.com/lucas-clemente/quic-go/send_stream.go +++ b/vendor/github.com/lucas-clemente/quic-go/send_stream.go @@ -97,7 +97,7 @@ func (s *sendStream) Write(p []byte) (int, error) { s.dataForWriting = make([]byte, len(p)) copy(s.dataForWriting, p) - s.sender.onHasStreamData(s.streamID) + go s.sender.onHasStreamData(s.streamID) var bytesWritten int var err error @@ -222,7 +222,7 @@ func (s *sendStream) Close() error { return fmt.Errorf("Close called for canceled stream %d", s.streamID) } s.finishedWriting = true - s.sender.onHasStreamData(s.streamID) // need to send the FIN + go s.sender.onHasStreamData(s.streamID) // need to send the FIN s.ctxCancel() return nil } @@ -268,10 +268,14 @@ func (s *sendStream) handleStopSendingFrame(frame *wire.StopSendingFrame) { func (s *sendStream) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) { s.flowController.UpdateSendWindow(frame.ByteOffset) s.mutex.Lock() + hasData := false if s.dataForWriting != nil { - s.sender.onHasStreamData(s.streamID) + hasData = true } s.mutex.Unlock() + if hasData { + s.sender.onHasStreamData(s.streamID) + } } // must be called after locking the mutex