diff options
| author | Dark1-dev <shansarkar272@gmail.com> | 2023-03-01 21:30:57 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-01 21:30:57 +0600 |
| commit | 60a301a93b6057bb2c54ac04a7c38c38389037b3 (patch) | |
| tree | b09c5f8bc0045828c660654d8ed6744663856202 /src/TcpTasks/SyncClient/syncclient.h | |
| parent | c784240d1af68dbd8d0466822b34fd05d6ccdda1 (diff) | |
| download | Masterserver-Qt5-60a301a93b6057bb2c54ac04a7c38c38389037b3.tar.gz Masterserver-Qt5-60a301a93b6057bb2c54ac04a7c38c38389037b3.zip | |
Add files via upload
Diffstat (limited to 'src/TcpTasks/SyncClient/syncclient.h')
| -rw-r--r-- | src/TcpTasks/SyncClient/syncclient.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/TcpTasks/SyncClient/syncclient.h b/src/TcpTasks/SyncClient/syncclient.h new file mode 100644 index 0000000..8cf253f --- /dev/null +++ b/src/TcpTasks/SyncClient/syncclient.h @@ -0,0 +1,50 @@ +#ifndef SYNCCLIENT_H +#define SYNCCLIENT_H + +#include <QTimer> +#include <QTcpSocket> +#include <QHostAddress> + +#include "Core/CoreObject/coreobject.h" +#include "Database/Common/commonactions.h" +#include "Protocols/GameSpy0/gamespy0.h" +#include "Protocols/GameSpy0/securevalidate.h" + +class SyncClient: public QObject +{ + Q_OBJECT +public: + SyncClient(const QSharedPointer<CoreObject> &coreObject, + const QString &remoteHost, + const unsigned short int &remotePort); + +private: + QSharedPointer<CoreObject> _coreObject; + const int _timeOutTime_ms = 7500; + + // tcp client handles + QTcpSocket _tcpSocket; + QTimer _timeOut; + QString _rxBuffer = ""; + QString _clientLabel; + + // helpers + int _queryId = 0; + + // functions + QStringList replyQuery(const QMultiHash<QString, QString> &query); + +private: // update sync time in database + bool updateSyncedServer(const QString &serverAddress, + const unsigned short &serverPort); + +private slots: + void onSyncConnect(); + void onSyncRead(); + void onSyncDisconnect(); + void onSyncTimeOut(); + +signals: +}; + +#endif // SYNCCLIENT_H |
