diff --git a/go.mod b/go.mod index 858bea96..173824a9 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/urfave/cli v1.22.16 github.com/xtaci/kcp-go/v5 v5.6.18 github.com/xtaci/qpp v1.1.18 - github.com/xtaci/smux v1.5.32 + github.com/xtaci/smux v1.5.33 github.com/xtaci/tcpraw v1.2.31 golang.org/x/crypto v0.31.0 ) diff --git a/go.sum b/go.sum index 52bcf4ff..d8e48683 100644 --- a/go.sum +++ b/go.sum @@ -76,6 +76,8 @@ github.com/xtaci/qpp v1.1.18 h1:FyULigD8/msXdxj9AjOFQg3/Z/tGz4574n21shZ6SZo= github.com/xtaci/qpp v1.1.18/go.mod h1:DI0dcoZ+qu4ze5C0hkt8grLfTVqBiZ3hXTimGyg5TTI= github.com/xtaci/smux v1.5.32 h1:IDdOaJDf8jk5NHKlTw05ge+0rdMjnXg3cwHkss5Pbcw= github.com/xtaci/smux v1.5.32/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY= +github.com/xtaci/smux v1.5.33 h1:xosoZt0AUZdIXEB6z09kt1bge+l1L8wzMtJdPB6GAPI= +github.com/xtaci/smux v1.5.33/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY= github.com/xtaci/tcpraw v1.2.31 h1:i9mXzejnGJdGi0DpVKUn19Hq202/sHOJt0kObEwuE/U= github.com/xtaci/tcpraw v1.2.31/go.mod h1:T1blYD2EDkLneb+HtxddnzX38SoC9BG537EhkXeaT2k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/vendor/github.com/xtaci/smux/session.go b/vendor/github.com/xtaci/smux/session.go index 19806be0..36540e60 100644 --- a/vendor/github.com/xtaci/smux/session.go +++ b/vendor/github.com/xtaci/smux/session.go @@ -348,12 +348,15 @@ func (s *Session) RemoteAddr() net.Addr { // notify the session that a stream has closed func (s *Session) streamClosed(sid uint32) { s.streamLock.Lock() - if n := s.streams[sid].recycleTokens(); n > 0 { // return remaining tokens to the bucket - if atomic.AddInt32(&s.bucket, int32(n)) > 0 { - s.notifyBucket() + if stream, ok := s.streams[sid]; ok { + n := stream.recycleTokens() + if n > 0 { // return remaining tokens to the bucket + if atomic.AddInt32(&s.bucket, int32(n)) > 0 { + s.notifyBucket() + } } + delete(s.streams, sid) } - delete(s.streams, sid) s.streamLock.Unlock() } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5ec73a46..a170579c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -50,7 +50,7 @@ github.com/xtaci/kcp-go/v5 # github.com/xtaci/qpp v1.1.18 ## explicit; go 1.22.3 github.com/xtaci/qpp -# github.com/xtaci/smux v1.5.32 +# github.com/xtaci/smux v1.5.33 ## explicit; go 1.13 github.com/xtaci/smux # github.com/xtaci/tcpraw v1.2.31