
* never send an unencoded packet to the server * oops * Improve packet validation to remove segfaults * WARNING: commit breaks connecting to servers, need help start fixing omniwhy caused by single fuckin string packets (AAAAAAAAAAAAAAAAA) * Fix failed connections to servers (Thanks to @Iuvee for helping me figure this out!) * Fix demoserver * who the fuck still uses goto Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * ANOTHER GOTO???? Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * braces Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * good bot Update src/packet_distribution.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix demoserver harder * Improve demo logging * Fix memory leakage by deleting the packet Fix useless demoserver wait packet creation when none of that packet is used Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#ifndef DEMOSERVER_H
|
|
#define DEMOSERVER_H
|
|
|
|
#include "aopacket.h"
|
|
|
|
#include <QDebug>
|
|
#include <QObject>
|
|
#include <QQueue>
|
|
#include <QTcpServer>
|
|
#include <QTcpSocket>
|
|
#include <QTimer>
|
|
#include <QFileDialog>
|
|
#include <QMessageBox>
|
|
|
|
class DemoServer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DemoServer(QObject *parent = nullptr);
|
|
|
|
bool server_started = false;
|
|
int port = 27088;
|
|
int max_wait = -1;
|
|
|
|
private:
|
|
void handle_packet(AOPacket *packet);
|
|
void load_demo(QString filename);
|
|
void reset_state();
|
|
|
|
QTcpServer* tcp_server;
|
|
QTcpSocket* client_sock = nullptr;
|
|
bool client_connected = false;
|
|
bool partial_packet = false;
|
|
bool debug_mode = false;
|
|
QString temp_packet = "";
|
|
QQueue<QString> demo_data;
|
|
QString sc_packet;
|
|
int num_chars = 0;
|
|
QString p_path;
|
|
QTimer *timer;
|
|
int elapsed_time = 0;
|
|
|
|
private slots:
|
|
void accept_connection();
|
|
void destroy_connection();
|
|
void recv_data();
|
|
void client_disconnect();
|
|
void playback();
|
|
|
|
public slots:
|
|
void start_server();
|
|
|
|
signals:
|
|
void skip_timers(qint64 msecs);
|
|
};
|
|
|
|
#endif // DEMOSERVER_H
|