diff --git a/network/gossip.go b/network/gossip.go index 442d68ef4..590dde8b9 100644 --- a/network/gossip.go +++ b/network/gossip.go @@ -100,7 +100,7 @@ func (g *gossipService) onReceiveMessage(m *lp2pps.Message) { return } - g.logger.Debug("receiving new gossip message", + g.logger.Trace("receiving new gossip message", "source", m.GetFrom(), "from", m.ReceivedFrom) event := &GossipMessage{ Source: m.GetFrom(), diff --git a/network/network.go b/network/network.go index 5a6ff315a..fd2c955be 100644 --- a/network/network.go +++ b/network/network.go @@ -95,8 +95,15 @@ func newNetwork(networkName string, conf *Config, opts []lp2p.Option) (*network, return nil, LibP2PError{Err: err} } - rmgr, err := lp2prcmgr.NewResourceManager( - lp2prcmgr.NewFixedLimiter(lp2prcmgr.DefaultLimits.AutoScale()), + maxconns := conf.MaxConns + changes := lp2prcmgr.PartialLimitConfig{} + changes.System.ConnsInbound = lp2prcmgr.LimitVal(2 * maxconns) + changes.System.ConnsOutbound = lp2prcmgr.LimitVal(2 * maxconns) + changes.System.Conns = lp2prcmgr.LimitVal(4 * maxconns) + limit := changes.Build(lp2prcmgr.DefaultLimits.AutoScale()) + + resMgr, err := lp2prcmgr.NewResourceManager( + lp2prcmgr.NewFixedLimiter(limit), lp2prcmgr.WithTraceReporter(str), ) if err != nil { @@ -116,7 +123,7 @@ func newNetwork(networkName string, conf *Config, opts []lp2p.Option) (*network, lp2p.Identity(networkKey), lp2p.ListenAddrStrings(conf.Listens...), lp2p.UserAgent(version.Agent()), - lp2p.ResourceManager(rmgr), + lp2p.ResourceManager(resMgr), lp2p.ConnectionManager(connMgr), ) diff --git a/network/notifee.go b/network/notifee.go index 3a638a1b5..9a7d02eb3 100644 --- a/network/notifee.go +++ b/network/notifee.go @@ -32,10 +32,10 @@ func (n *NotifeeService) Connected(lp2pn lp2pnetwork.Network, conn lp2pnetwork.C peerID := conn.RemotePeer() go func() { - for i := 0; i < 6; i++ { + for i := 0; i < 10; i++ { // TODO: better way? // Wait to complete libp2p identify - time.Sleep(200 * time.Millisecond) + time.Sleep(500 * time.Millisecond) protocols, _ := lp2pn.Peerstore().SupportsProtocols(peerID, n.protocolID) if len(protocols) > 0 {