diff options
Diffstat (limited to 'mock-jetting-controller/MockServer.cpp')
| -rw-r--r-- | mock-jetting-controller/MockServer.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/mock-jetting-controller/MockServer.cpp b/mock-jetting-controller/MockServer.cpp index 08eb116..ac186cd 100644 --- a/mock-jetting-controller/MockServer.cpp +++ b/mock-jetting-controller/MockServer.cpp @@ -121,14 +121,11 @@ MockServer::onSocketMessageReady () void MockServer::tick () { - /* Send KA_PING on connected sockets, retry connection on disconnected. */ + /* Retry connection on disconnected sockets. Keepalive pings are originated + by the interface; the controller only replies to them. */ for (auto *port : { &m_command, &m_imaging, &m_status }) - { - if (port->socket.state () == QAbstractSocket::ConnectedState) - sendReply (port->socket, "KA_PING\n"); - else if (port->socket.state () == QAbstractSocket::UnconnectedState) - port->socket.connectToHost (m_host, port->number); - } + if (port->socket.state () == QAbstractSocket::UnconnectedState) + port->socket.connectToHost (m_host, port->number); } void @@ -241,11 +238,9 @@ MockServer::sendReply (QTcpSocket &socket, const QByteArray &data) void MockServer::handleKaPing (Port &port, const QByteArray ¶ms) { - QByteArray wire; - if (s_wireDebug) - wire = " << KA_PING," + params; - qDebug ("%s RX KA_PING ACK%s", qPrintable (logTag (&port.socket)), - wire.constData ()); + Q_UNUSED (params); + /* Reply to the interface's keepalive ping. */ + sendReply (port.socket, "KA_PING,1\n"); } void |
