Remove ProcessResult
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -6,10 +6,12 @@
|
||||
#include <csignal>
|
||||
#include <iostream>
|
||||
|
||||
// TODO this should be scoped to a particular Server, and it's definition should
|
||||
// be in server.cpp or connection.cpp
|
||||
std::atomic<int> activeConnections{0};
|
||||
|
||||
// Global server instance for signal handler access
|
||||
Server *g_server = nullptr;
|
||||
static Server *g_server = nullptr;
|
||||
|
||||
void signal_handler(int sig) {
|
||||
if (sig == SIGTERM || sig == SIGINT) {
|
||||
@@ -27,17 +29,10 @@ void signal_handler(int sig) {
|
||||
*/
|
||||
class EchoHandler : public ConnectionHandler {
|
||||
public:
|
||||
ProcessResult process_data(std::string_view data,
|
||||
std::unique_ptr<Connection> &conn_ptr) override {
|
||||
void process_data(std::string_view data,
|
||||
std::unique_ptr<Connection> &conn_ptr) override {
|
||||
// Echo the received data back to the client
|
||||
conn_ptr->appendMessage(data);
|
||||
return ProcessResult::Continue;
|
||||
}
|
||||
|
||||
void on_connection_established(Connection &conn) override {
|
||||
// Could send a welcome message if desired
|
||||
// conn.appendMessage("Welcome to WeaselDB echo server\n");
|
||||
(void)conn; // Suppress unused parameter warning
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user