diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index dc99f5c2..30fedb76 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -401,8 +401,8 @@ int main(int argc, char* argv[], char* envp[]) { // create the MainLoop and start it s_mainLoop = new MainLoop(s_opt, device, s_messageMap, s_scanHelper, s_requestQueue); + BusHandler* busHandler = s_mainLoop->getBusHandler(); if (s_opt.injectMessages) { - BusHandler* busHandler = s_mainLoop->getBusHandler(); int scanAdrCount = 0; bool scanAddresses[256] = {}; while (arg_index < argc) { @@ -420,6 +420,7 @@ int main(int argc, char* argv[], char* envp[]) { scanAdrCount++; } } + busHandler->getProtocol()->start("bushandler"); for (symbol_t address = 0; scanAdrCount > 0; address++) { if (scanAddresses[address]) { scanAdrCount--; @@ -430,6 +431,8 @@ int main(int argc, char* argv[], char* envp[]) { shutdown(); return 0; } + } else { + busHandler->getProtocol()->start("bushandler"); } s_mainLoop->start("mainloop"); diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index 5e0eec94..e820e31d 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -164,7 +164,6 @@ MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messag m_busHandler = new BusHandler(m_device, m_messages, scanHelper, config, opt.pollInterval); m_protocol = m_busHandler->getProtocol(); - m_protocol->start("bushandler"); // create network m_htmlPath = opt.htmlPath; diff --git a/src/lib/ebus/protocol.h b/src/lib/ebus/protocol.h index b7faa8e7..eb743b45 100755 --- a/src/lib/ebus/protocol.h +++ b/src/lib/ebus/protocol.h @@ -245,7 +245,6 @@ class ProtocolHandler : public WaitThread { * Destructor. */ virtual ~ProtocolHandler() { - stop(); join(); BusRequest* req; while ((req = m_finishedRequests.pop()) != nullptr) { diff --git a/test_coverage.sh b/test_coverage.sh index 8bb7a0dd..c664125e 100755 --- a/test_coverage.sh +++ b/test_coverage.sh @@ -247,7 +247,7 @@ elif [[ -n "$1" ]]; then pid=$(ps -C ebusd -o pid=) done else - $ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile="$PWD/acl.csv" --mqttport=1883 --enablehex --enabledefine + $ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s --scanretries=0 -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile="$PWD/acl.csv" --mqttport=1883 --enablehex --enabledefine sleep 3 pid=`head -n 1 "$PWD/ebusd.pid"` fi @@ -359,7 +359,6 @@ decode -V -N UCH 102030 encode UCH,,,,uch 10;1 raw bytes raw -reload nocommand EOF status=1