MCPcopy Create free account
hub / github.com/DNAProject/DNA / connectSeedService

Method connectSeedService

p2pserver/p2pserver.go:451–468  ·  view source on GitHub ↗

connectSeedService make sure seed peer be connected

()

Source from the content-addressed store, hash-verified

449
450//connectSeedService make sure seed peer be connected
451func (this *P2PServer) connectSeedService() {
452 t := time.NewTimer(time.Second * common.CONN_MONITOR)
453 for {
454 select {
455 case <-t.C:
456 this.connectSeeds()
457 t.Stop()
458 if this.reachMinConnection() {
459 t.Reset(time.Second * time.Duration(10*common.CONN_MONITOR))
460 } else {
461 t.Reset(time.Second * common.CONN_MONITOR)
462 }
463 case <-this.quitOnline:
464 t.Stop()
465 return
466 }
467 }
468}
469
470//keepOnline try connect lost peer
471func (this *P2PServer) keepOnlineService() {

Callers 1

StartMethod · 0.95

Calls 4

connectSeedsMethod · 0.95
reachMinConnectionMethod · 0.95
StopMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected