MUX: Refine and Fix some occasional problems (#4861)

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
patterniha 2025-07-23 12:09:04 +02:00 committed by GitHub
parent 050f596e8f
commit 308f8a7459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 16 deletions

View file

@ -276,6 +276,8 @@ func (m *ClientWorker) IsClosing() bool {
return false
}
// IsFull returns true if this ClientWorker is unable to accept more connections.
// it might be because it is closing, or the number of connections has reached the limit.
func (m *ClientWorker) IsFull() bool {
if m.IsClosing() || m.Closed() {
return true
@ -289,12 +291,12 @@ func (m *ClientWorker) IsFull() bool {
}
func (m *ClientWorker) Dispatch(ctx context.Context, link *transport.Link) bool {
if m.IsFull() || m.Closed() {
if m.IsFull() {
return false
}
sm := m.sessionManager
s := sm.Allocate()
s := sm.Allocate(&m.strategy)
if s == nil {
return false
}