Skip to content

Commit

Permalink
fix: set default behavior instead of waiting for dialer to be ready a…
Browse files Browse the repository at this point in the history
…t bandit
  • Loading branch information
WendelHime committed Nov 26, 2024
1 parent 8eba259 commit 7721192
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dialer/bandit.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,15 @@ func (o *BanditDialer) chooseDialerForDomain(network, addr string) (ProxyDialer,
d = o.dialers[chosenArm]
readyChan := d.Ready()
if readyChan != nil {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
select {
case err := <-readyChan:
if err != nil {
log.Errorf("dialer %q initialization failed: %w", d.Name(), err)
chosenArm = differentArm(chosenArm, len(o.dialers))
continue
}
case <-ctx.Done():
log.Errorf("dialer %q initialization timed out", d.Name())
default:
log.Debugf("dialer %q is not ready, chossing different arm", d.Name())
chosenArm = differentArm(chosenArm, len(o.dialers))
continue
}
Expand Down

0 comments on commit 7721192

Please sign in to comment.