Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/improve redialing public autoconnect #945

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/servicedisc/autoconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,22 @@ func (a *autoconnector) Run(ctx context.Context) (err error) {

for {
time.Sleep(PublicServiceDelay)

// successfully established transports
tps := a.tm.GetTransportsByLabel(transport.LabelAutomatic)

// don't fetch public addresses if there are more or equal to the number of maximum transport defined.
if len(tps) >= a.maxConns {
a.log.Infoln("autoconnect: maximum number of established transports reached: ", a.maxConns)
return err
jdknives marked this conversation as resolved.
Show resolved Hide resolved
}

a.log.Infoln("Fetching public visors")
addrs, err := a.fetchPubAddresses(ctx)
if err != nil {
a.log.Errorf("Cannot fetch public services: %s", err)
}

// successfully established transports
tps := a.tm.GetTransportsByLabel(transport.LabelAutomatic)
// filter out any established transports
absent := a.filterDuplicates(addrs, tps)

Expand Down