Fix P2P Connectivity Regression + Dynamic Versioning System #12
@@ -2,7 +2,7 @@ version: "3.9"
|
||||
|
||||
services:
|
||||
chorus:
|
||||
image: anthonyrawlins/chorus:v0.5.4-p2p-fix
|
||||
image: anthonyrawlins/chorus:v0.5.5-p2p-simple
|
||||
|
||||
# REQUIRED: License configuration (CHORUS will not start without this)
|
||||
environment:
|
||||
|
||||
16
p2p/node.go
16
p2p/node.go
@@ -11,7 +11,6 @@ import (
|
||||
kaddht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/libp2p/go-libp2p/p2p/net/connmgr"
|
||||
"github.com/libp2p/go-libp2p/p2p/security/noise"
|
||||
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
@@ -46,26 +45,13 @@ func NewNode(ctx context.Context, opts ...Option) (*Node, error) {
|
||||
listenAddrs = append(listenAddrs, ma)
|
||||
}
|
||||
|
||||
// Create connection manager with scaling-optimized limits
|
||||
connManager, err := connmgr.NewConnManager(
|
||||
config.LowWatermark, // Low watermark (32)
|
||||
config.HighWatermark, // High watermark (128)
|
||||
connmgr.WithGracePeriod(30*time.Second), // Grace period before pruning
|
||||
)
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, fmt.Errorf("failed to create connection manager: %w", err)
|
||||
}
|
||||
|
||||
// Create libp2p host with security, transport, and scaling options
|
||||
// Create libp2p host with security and transport options
|
||||
h, err := libp2p.New(
|
||||
libp2p.ListenAddrs(listenAddrs...),
|
||||
libp2p.Security(noise.ID, noise.New),
|
||||
libp2p.Transport(tcp.NewTCPTransport),
|
||||
libp2p.DefaultMuxers,
|
||||
libp2p.EnableRelay(),
|
||||
libp2p.ConnectionManager(connManager), // Add connection management
|
||||
libp2p.EnableAutoRelayWithStaticRelays([]peer.AddrInfo{}), // Enable AutoRelay with empty static list
|
||||
)
|
||||
if err != nil {
|
||||
cancel()
|
||||
|
||||
Reference in New Issue
Block a user