diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-13 11:58:45 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-13 11:58:45 +0100 |
| commit | 02fe86ab2a04a02b114d7ca8ce4374a29a1d5f45 (patch) | |
| tree | ebec2643d7238d0447a236a278757c718b0ef0ac /mock-server/EchoServer.h | |
| parent | a2b1ccf17845e55caef7f69a5e68f49a55b6a166 (diff) | |
| download | QtXpl2-02fe86ab2a04a02b114d7ca8ce4374a29a1d5f45.tar.gz QtXpl2-02fe86ab2a04a02b114d7ca8ce4374a29a1d5f45.zip | |
Coalesce mock server into single MockServer class
Replace three independent EchoServer instances with one MockServer
that owns three QTcpServers, shares a single KA_PING timer, and
uses a flat client list with localPort() for port resolution.
Diffstat (limited to 'mock-server/EchoServer.h')
| -rw-r--r-- | mock-server/EchoServer.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/mock-server/EchoServer.h b/mock-server/EchoServer.h deleted file mode 100644 index c0a41c9..0000000 --- a/mock-server/EchoServer.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file EchoServer.h - * @brief Mock XPL2 server for a single port. - */ -#pragma once - -#include <QList> -#include <QTcpServer> -#include <QTimer> - -class QTcpSocket; - -class EchoServer : public QTcpServer -{ - Q_OBJECT - -public: - EchoServer (quint16 port, const char *name, QObject *parent = nullptr); - -private slots: - void onNewConnection (); - void onClientMessageReady (); - void onClientDisconnected (); - void sendKaPing (); - -private: - void handleCommand (QTcpSocket *client, const QByteArray &line); - - const char *m_name; - quint16 m_port; - QList<QTcpSocket *> m_clients; - QTimer m_pingTimer; -}; |
