Files
jak-project/common/repl/nrepl/ReplServer.h
T
Tyler Wilding 00ac12094e goalc/repl: cleanup of goalc/REPL code and some QoL improvements (#2104)
- lets you split up your `startup.gc` file into two sections
  - one that runs on initial startup / reloads
  - the other that runs when you listen to a target
- allows for customization of the keybinds added a month or so ago
- removes a useless flag (--startup-cmd) and marks others for
deprecation.
- added another help prompt that lists all the keybinds and what they do

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-07 11:24:02 -05:00

32 lines
627 B
C++

#pragma once
#include <optional>
#include <set>
#include "common/cross_sockets/XSocketServer.h"
enum ReplServerMessageType { PING = 0, EVAL = 10, SHUTDOWN = 20 };
struct ReplServerHeader {
u32 length;
u32 type;
};
class ReplServer : public XSocketServer {
public:
using XSocketServer::XSocketServer;
virtual ~ReplServer();
void post_init() override;
std::optional<std::string> get_msg();
private:
int max_clients = 50;
std::vector<char> header_buffer = std::vector<char>((int)sizeof(ReplServerHeader));
fd_set read_sockets;
std::set<int> client_sockets = {};
void ping_response(int socket);
};