Add logging for bad messages and listen on 0.0.0.0
This commit is contained in:
parent
8bd53abf65
commit
a05bd9537b
@ -32,13 +32,15 @@ void DataFeed::handleInit() {
|
|||||||
|
|
||||||
void DataFeed::read() {
|
void DataFeed::read() {
|
||||||
while (m_dev->bytesAvailable()) {
|
while (m_dev->bytesAvailable()) {
|
||||||
const auto doc = QJsonDocument::fromJson(m_dev->readLine());
|
auto json = m_dev->readLine();
|
||||||
|
const auto doc = QJsonDocument::fromJson(json);
|
||||||
if (m_procData) {
|
if (m_procData) {
|
||||||
const auto msg = doc.object();
|
const auto msg = doc.object();
|
||||||
if (msg["type"] == "TraceEvent") {
|
if (msg["type"] == "TraceEvent") {
|
||||||
const auto te = msg["data"].toObject();
|
m_procData->traceEvents.push_back(msg["data"].toObject());
|
||||||
m_procData->traceEvents.push_back(te);
|
|
||||||
emit m_procData->traceEvent(m_procData->traceEvents.last());
|
emit m_procData->traceEvent(m_procData->traceEvents.last());
|
||||||
|
} else {
|
||||||
|
qDebug().noquote() << "Bad message:" << json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +48,7 @@ void DataFeed::read() {
|
|||||||
|
|
||||||
|
|
||||||
LogServer::LogServer() {
|
LogServer::LogServer() {
|
||||||
m_server->listen(QHostAddress::LocalHost, 5590);
|
m_server->listen(QHostAddress::Any, 5590);
|
||||||
connect(m_server, &QTcpServer::newConnection, this, &LogServer::handleConnection);
|
connect(m_server, &QTcpServer::newConnection, this, &LogServer::handleConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user