Console wip, change how we send acks back to some old behavior

This commit is contained in:
KimLS
2017-04-04 23:21:32 -07:00
parent 281483efc1
commit 8509f05f0a
9 changed files with 1070 additions and 883 deletions
+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include "../common/net/tcp_server.h"
#include "../common/event/timer.h"
#include <map>
#include <vector>
class ConsoleServer;
class ConsoleConnection
{
public:
ConsoleConnection(ConsoleServer *parent, std::shared_ptr<EQ::Net::TCPConnection> connection);
~ConsoleConnection();
std::string GetUUID() const { return m_uuid; }
void Clear();
void SendLine(const std::string &line);
void SendNewLine();
private:
void OnRead(EQ::Net::TCPConnection* c, const unsigned char* data, size_t sz);
void ProcessReadBuffer();
void ProcessCommand(const std::string& cmd);
void OnDisconnect(EQ::Net::TCPConnection* c);
ConsoleServer *m_parent;
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
std::string m_uuid;
std::vector<char> m_buffer;
};
class ConsoleServer
{
public:
ConsoleServer();
~ConsoleServer();
void ConnectionDisconnected(ConsoleConnection *c);
private:
std::unique_ptr<EQ::Net::TCPServer> m_server;
std::map<std::string, std::unique_ptr<ConsoleConnection>> m_connections;
friend class ConsoleConnection;
};