mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-02 12:53:09 +00:00
make initial delay for direct peer connections a variable
This commit is contained in:
parent
2eaa566371
commit
ca7b1f3dbf
@ -64,6 +64,9 @@ var (
|
||||
// currently connected
|
||||
GossipSubDirectConnectTicks uint64 = 300
|
||||
|
||||
// Initial delay before opening connections to direct peers
|
||||
GossipSubDirectConnectInitialDelay = time.Second
|
||||
|
||||
// Number of heartbeat ticks for attempting to improve the mesh with opportunistic
|
||||
// grafting
|
||||
GossipSubOpportunisticGraftTicks uint64 = 60
|
||||
@ -287,8 +290,9 @@ func (gs *GossipSubRouter) Attach(p *PubSub) {
|
||||
// connect to direct peers
|
||||
if len(gs.direct) > 0 {
|
||||
go func() {
|
||||
// add a small delay to make this unit-testable
|
||||
time.Sleep(time.Second)
|
||||
if GossipSubDirectConnectInitialDelay > 0 {
|
||||
time.Sleep(GossipSubDirectConnectInitialDelay)
|
||||
}
|
||||
for p := range gs.direct {
|
||||
gs.connect <- connectInfo{p: p}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user