Skip to content

Commit

Permalink
Merge pull request #1299 from mrpalide/fix/no-autotranpsort-when-is-a…
Browse files Browse the repository at this point in the history
…vailable

Skip auto-transport when transport available
  • Loading branch information
jdknives authored Jul 28, 2022
2 parents 9a9de1d + a9f914f commit dcd5825
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/visor/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ func getRouteSetupHooks(ctx context.Context, v *Visor, log *logging.Logger) []ro
retrier := netutil.NewRetrier(log, time.Second, time.Second*20, 3, 1.3)
return []router.RouteSetupHook{
func(rPK cipher.PubKey, tm *transport.Manager) error {
establishedTransports, _ := v.Transports([]string{string(network.STCPR), string(network.SUDPH), string(network.DMSG)}, []cipher.PubKey{v.conf.PK}, false) //nolint
for _, transportSum := range establishedTransports {
if transportSum.Remote.Hex() == rPK.Hex() {
log.Debugf("Established transport exist. Type: %s", transportSum.Type)
return nil
}
}

allTransports, err := v.arClient.Transports(ctx)
if err != nil {
log.WithError(err).Warn("failed to fetch AR transport")
Expand Down

0 comments on commit dcd5825

Please sign in to comment.