syncUpRecentPeers sync up recent peers periodically
()
| 593 | |
| 594 | //syncUpRecentPeers sync up recent peers periodically |
| 595 | func (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 |
| 611 | func (this *P2PServer) syncPeerAddr() { |
no test coverage detected