Skip to content

Commit db6d6a8

Browse files
committed
fix infinite loop in mux dispatch
1 parent fcce267 commit db6d6a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common/mux/client.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type ClientManager struct {
2525
}
2626

2727
func (m *ClientManager) Dispatch(ctx context.Context, link *transport.Link) error {
28-
for {
28+
for i := 0; i < 16; i++ {
2929
worker, err := m.Picker.PickAvailable()
3030
if err != nil {
3131
return err
@@ -34,6 +34,8 @@ func (m *ClientManager) Dispatch(ctx context.Context, link *transport.Link) erro
3434
return nil
3535
}
3636
}
37+
38+
return newError("unable to find an available mux client")
3739
}
3840

3941
type WorkerPicker interface {

0 commit comments

Comments
 (0)