fix: Add CC for TUIC server

This commit is contained in:
Larvan2 2023-01-17 01:07:28 +08:00
parent f3b76df13b
commit db4f3eda55
2 changed files with 4 additions and 1 deletions

View File

@ -92,6 +92,7 @@ func ParseListener(mapping map[string]any) (C.InboundListener, error) {
AuthenticationTimeout: 1000, AuthenticationTimeout: 1000,
ALPN: []string{"h3"}, ALPN: []string{"h3"},
MaxUdpRelayPacketSize: 1500, MaxUdpRelayPacketSize: 1500,
CongestionController: "bbr",
} }
err = decoder.Decode(mapping, tuicOption) err = decoder.Decode(mapping, tuicOption)
if err != nil { if err != nil {

View File

@ -73,6 +73,7 @@ func (s *Server) Close() error {
} }
type serverHandler struct { type serverHandler struct {
serverOption ServerOption
*Server *Server
quicConn quic.Connection quicConn quic.Connection
uuid uuid.UUID uuid uuid.UUID
@ -166,7 +167,7 @@ func (s *serverHandler) handleStream() (err error) {
if err != nil { if err != nil {
return err return err
} }
SetCongestionController(s.quicConn, s.CongestionController)
go func() (err error) { go func() (err error) {
stream := &quicStreamConn{ stream := &quicStreamConn{
Stream: quicStream, Stream: quicStream,
@ -214,6 +215,7 @@ func (s *serverHandler) handleUniStream() (err error) {
if err != nil { if err != nil {
return err return err
} }
SetCongestionController(s.quicConn, s.CongestionController)
go func() (err error) { go func() (err error) {
defer func() { defer func() {
stream.CancelRead(0) stream.CancelRead(0)