run runs the synchronisation client.
()
| 530 | |
| 531 | // run runs the synchronisation client. |
| 532 | func (sc *syncClient) run() { |
| 533 | for { |
| 534 | select { |
| 535 | case <-sc.stopped: |
| 536 | <-sc.start |
| 537 | log.Infof("Starting sync client...") |
| 538 | default: |
| 539 | sc.runOnce() |
| 540 | select { |
| 541 | // TODO: If we receive on quit inside runOnce, we have to wait the |
| 542 | // 5s here before enable will work again. |
| 543 | case <-time.After(5 * time.Second): |
| 544 | case <-sc.quit: |
| 545 | sc.stopped <- true |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | func (sc *syncClient) peerConfigured() bool { |
| 552 | return sc.engine.config.Peer.IPv4Addr != nil || sc.engine.config.Peer.IPv6Addr != nil |