| 560 | } |
| 561 | |
| 562 | void TorController::disconnected_cb(TorControlConnection& _conn) |
| 563 | { |
| 564 | // Stop advertising service when disconnected |
| 565 | if (service.IsValid()) |
| 566 | RemoveLocal(service); |
| 567 | service = CService(); |
| 568 | if (!reconnect) |
| 569 | return; |
| 570 | |
| 571 | LogPrint(BCLog::TOR, "tor: Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center); |
| 572 | |
| 573 | // Single-shot timer for reconnect. Use exponential backoff. |
| 574 | struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0)); |
| 575 | if (reconnect_ev) |
| 576 | event_add(reconnect_ev, &time); |
| 577 | reconnect_timeout *= RECONNECT_TIMEOUT_EXP; |
| 578 | } |
| 579 | |
| 580 | void TorController::Reconnect() |
| 581 | { |
nothing calls this directly
no test coverage detected