MCPcopy Create free account
hub / github.com/LUX-Core/lux / LuxController

Method LuxController

src/luxcontrol.cpp:434–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432};
433
434LuxController::LuxController(struct event_base* _base, const std::string& _target):
435 base(_base),
436 target(_target), conn(base), reconnect(true), reconnect_ev(0),
437 reconnect_timeout(RECONNECT_TIMEOUT_START)
438{
439 reconnect_ev = event_new(base, -1, 0, reconnect_cb, this);
440 if (!reconnect_ev)
441 LogPrintf("lux: Failed to create event for reconnection: out of memory?\n");
442 // Start connection attempts immediately
443 if (!conn.Connect(_target, boost::bind(&LuxController::connected_cb, this, _1),
444 boost::bind(&LuxController::disconnected_cb, this, _1) )) {
445 LogPrintf("lux: Initiating connection to Lux control port %s failed\n", _target);
446 }
447 // Read service private key if cached
448 std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
449 if (pkf.first) {
450 LogPrint("lux", "lux: Reading cached private key from %s\n", GetPrivateKeyFile());
451 private_key = pkf.second;
452 }
453}
454
455LuxController::~LuxController()
456{

Callers

nothing calls this directly

Calls 3

ReadBinaryFileFunction · 0.85
LogPrintFunction · 0.85
ConnectMethod · 0.45

Tested by

no test coverage detected