Skip to content

Commit

Permalink
set listener early
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Apr 2, 2021
1 parent 7b112c4 commit 891681a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ebusd/mainloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messag
: Thread(), m_device(device), m_reconnectCount(0), m_userList(opt.accessLevel), m_messages(messages),
m_address(opt.address), m_scanConfig(opt.scanConfig), m_initialScan(opt.readOnly ? ESC : opt.initialScan),
m_polling(opt.pollInterval > 0), m_enableHex(opt.enableHex), m_shutdown(false), m_runUpdateCheck(opt.updateCheck) {
m_device->setListener(this);
// open Device
result_t result = m_device->open();
if (result != RESULT_OK) {
logError(lf_bus, "unable to open %s: %s", m_device->getName(), getResultCode(result));
} else if (!m_device->isValid()) {
logError(lf_bus, "device %s not available", m_device->getName());
}
m_device->setListener(this);
if (opt.dumpFile[0]) {
m_dumpFile = new RotateFile(opt.dumpFile, opt.dumpSize, false, opt.dumpFlush ? 1 : 16);
m_dumpFile->setEnabled(opt.dump);
Expand Down

0 comments on commit 891681a

Please sign in to comment.