Browse Source

fix infinite loop in mux dispatch

Darien Raymond 7 years ago
parent
commit
db6d6a89df
1 changed files with 3 additions and 1 deletions
  1. 3 1
      common/mux/client.go

+ 3 - 1
common/mux/client.go

@@ -25,7 +25,7 @@ type ClientManager struct {
 }
 
 func (m *ClientManager) Dispatch(ctx context.Context, link *transport.Link) error {
-	for {
+	for i := 0; i < 16; i++ {
 		worker, err := m.Picker.PickAvailable()
 		if err != nil {
 			return err
@@ -34,6 +34,8 @@ func (m *ClientManager) Dispatch(ctx context.Context, link *transport.Link) erro
 			return nil
 		}
 	}
+
+	return newError("unable to find an available mux client")
 }
 
 type WorkerPicker interface {