| 671 | } |
| 672 | |
| 673 | void LuxController::disconnected_cb(LuxControlConnection& _conn) |
| 674 | { |
| 675 | // Stop advertising service when disconnected |
| 676 | if (service.IsValid()) |
| 677 | RemoveLocal(service); |
| 678 | service = CService(); |
| 679 | if (!reconnect) |
| 680 | return; |
| 681 | |
| 682 | LogPrint("lux", "lux: Not connected to Lux control port %s, trying to reconnect\n", target); |
| 683 | |
| 684 | // Single-shot timer for reconnect. Use exponential backoff. |
| 685 | struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0)); |
| 686 | if (reconnect_ev) |
| 687 | event_add(reconnect_ev, &time); |
| 688 | reconnect_timeout *= RECONNECT_TIMEOUT_EXP; |
| 689 | } |
| 690 | |
| 691 | void LuxController::Reconnect() |
| 692 | { |
nothing calls this directly
no test coverage detected