Skip to content

Commit

Permalink
Do not setup a connmanager if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Oct 25, 2023
1 parent 1c624ff commit 90265e8
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ import (
"github.com/peterbourgon/diskv"
)

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

// Config is the config struct for the node and the default EdgeVPN services
// It is used to generate opts for the node and the services before start.
type Config struct {
Expand Down Expand Up @@ -288,18 +283,6 @@ func (c Config) ToOpts(l *logger.Logger) ([]node.Option, []vpn.Option, error) {
llger.Fatal("could not create connection manager")
}

libp2pOpts = append(libp2pOpts, libp2p.ConnectionManager(cm))
} else {
llger.Infof("connmanager low-hi connections: %d", MaxInt)
cm, err := connmanager.NewConnManager(
MaxInt,
MaxInt,
connmanager.WithGracePeriod(80*time.Second),
)
if err != nil {
llger.Fatal("could not create connection manager")
}

libp2pOpts = append(libp2pOpts, libp2p.ConnectionManager(cm))
}

Expand Down

0 comments on commit 90265e8

Please sign in to comment.