mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-28 01:20:24 +00:00
@@ -19,8 +19,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "util/StopHelper.hpp"
|
||||
#include "util/Taggable.hpp"
|
||||
#include "util/log/Logger.hpp"
|
||||
#include "util/prometheus/Gauge.hpp"
|
||||
#include "util/prometheus/Label.hpp"
|
||||
#include "util/prometheus/Prometheus.hpp"
|
||||
#include "web/SubscriptionContextInterface.hpp"
|
||||
#include "web/ng/Connection.hpp"
|
||||
#include "web/ng/Error.hpp"
|
||||
@@ -33,8 +37,11 @@
|
||||
#include <boost/signals2/signal.hpp>
|
||||
#include <boost/signals2/variadic_signal.hpp>
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -77,6 +84,12 @@ private:
|
||||
std::optional<MessageHandler> wsHandler_;
|
||||
|
||||
boost::signals2::signal<void()> onStop_;
|
||||
std::unique_ptr<std::atomic_bool> stopping_ = std::make_unique<std::atomic_bool>(false);
|
||||
|
||||
std::reference_wrapper<util::prometheus::GaugeInt> connectionsCounter_ =
|
||||
PrometheusService::gaugeInt("connections_total_number", util::prometheus::Labels{{{"status", "connected"}}});
|
||||
|
||||
util::StopHelper stopHelper_;
|
||||
|
||||
public:
|
||||
ConnectionHandler(
|
||||
@@ -87,6 +100,8 @@ public:
|
||||
OnDisconnectHook onDisconnectHook
|
||||
);
|
||||
|
||||
static constexpr std::chrono::milliseconds kCLOSE_CONNECTION_TIMEOUT{500};
|
||||
|
||||
void
|
||||
onGet(std::string const& target, MessageHandler handler);
|
||||
|
||||
@@ -99,8 +114,14 @@ public:
|
||||
void
|
||||
processConnection(ConnectionPtr connection, boost::asio::yield_context yield);
|
||||
|
||||
static void
|
||||
stopConnection(Connection& connection, boost::asio::yield_context yield);
|
||||
|
||||
void
|
||||
stop();
|
||||
stop(boost::asio::yield_context yield);
|
||||
|
||||
bool
|
||||
isStopping() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user