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

Method syncUpRecentPeers

p2pserver/p2pserver.go:595–608  ·  view source on GitHub ↗

syncUpRecentPeers sync up recent peers periodically

()

Source from the content-addressed store, hash-verified

593
594//syncUpRecentPeers sync up recent peers periodically
595func (this *P2PServer) syncUpRecentPeers() {
596 periodTime := common.RECENT_TIMEOUT
597 t := time.NewTicker(time.Second * (time.Duration(periodTime)))
598 for {
599 select {
600 case <-t.C:
601 this.syncPeerAddr()
602 case <-this.quitSyncRecent:
603 t.Stop()
604 return
605 }
606 }
607
608}
609
610//syncPeerAddr compare snapshot of recent peer with current link,then persist the list
611func (this *P2PServer) syncPeerAddr() {

Callers 1

StartMethod · 0.95

Calls 2

syncPeerAddrMethod · 0.95
StopMethod · 0.65

Tested by

no test coverage detected