mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 05:43:06 +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
|
// currently connected
|
||||||
GossipSubDirectConnectTicks uint64 = 300
|
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
|
// Number of heartbeat ticks for attempting to improve the mesh with opportunistic
|
||||||
// grafting
|
// grafting
|
||||||
GossipSubOpportunisticGraftTicks uint64 = 60
|
GossipSubOpportunisticGraftTicks uint64 = 60
|
||||||
@ -287,8 +290,9 @@ func (gs *GossipSubRouter) Attach(p *PubSub) {
|
|||||||
// connect to direct peers
|
// connect to direct peers
|
||||||
if len(gs.direct) > 0 {
|
if len(gs.direct) > 0 {
|
||||||
go func() {
|
go func() {
|
||||||
// add a small delay to make this unit-testable
|
if GossipSubDirectConnectInitialDelay > 0 {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(GossipSubDirectConnectInitialDelay)
|
||||||
|
}
|
||||||
for p := range gs.direct {
|
for p := range gs.direct {
|
||||||
gs.connect <- connectInfo{p: p}
|
gs.connect <- connectInfo{p: p}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user