connectSeedService make sure seed peer be connected
()
| 449 | |
| 450 | //connectSeedService make sure seed peer be connected |
| 451 | func (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 |
| 471 | func (this *P2PServer) keepOnlineService() { |
no test coverage detected