1 parent
df99b6ea7f
commit
d146f11f02
63 files changed
+8331
-2709
No files matched your search
@@ -8,12 +8,15 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/beast.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#include <chrono>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace Echoion::Core
|
||||
{
|
||||
@@ -50,6 +53,16 @@ namespace Echoion::Core
|
||||
void removeAuthenticatedClient(uint64_t clientId);
|
||||
[[nodiscard]] bool isClientAuthenticated(uint64_t clientId);
|
||||
|
||||
// Server introspection (for GetServerInfo / GetAuditLog).
|
||||
struct AuditEntry {
|
||||
uint64_t clientId = 0;
|
||||
int method = 0;
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
};
|
||||
[[nodiscard]] std::vector<AuditEntry> getAuditLog() const;
|
||||
[[nodiscard]] size_t getClientCount() const;
|
||||
[[nodiscard]] std::chrono::seconds getUptime() const;
|
||||
|
||||
// Broadcast events to all connected clients
|
||||
void broadcastEvent(const std::string& event,
|
||||
const std::string& data);
|
||||
@@ -80,7 +93,7 @@ namespace Echoion::Core
|
||||
uint64_t,
|
||||
std::shared_ptr<websocket::stream<asio::ip::tcp::socket>>>
|
||||
clients_;
|
||||
std::mutex clientsMutex_;
|
||||
mutable std::mutex clientsMutex_;
|
||||
std::atomic<uint64_t> nextClientId_{1};
|
||||
|
||||
// Per-client handlers run on a Void worker pool instead of one
|
||||
@@ -96,6 +109,13 @@ namespace Echoion::Core
|
||||
std::mutex authMutex_;
|
||||
std::string authToken_;
|
||||
|
||||
// Audit ring + uptime tracking
|
||||
mutable std::mutex auditMutex_;
|
||||
std::deque<AuditEntry> auditLog_;
|
||||
static constexpr size_t MAX_AUDIT_ENTRIES = 500;
|
||||
std::chrono::steady_clock::time_point startTime_{
|
||||
std::chrono::steady_clock::now()};
|
||||
|
||||
// Command handlers
|
||||
std::unordered_map<std::string, CommandHandler> handlers_;
|
||||
std::mutex handlersMutex_;
|
||||
|
||||
Reference in new issue
Block a user