mirror of
https://github.com/XRPLF/clio.git
synced 2026-08-22 05:00:52 +00:00
@@ -30,14 +30,17 @@ namespace web {
|
||||
/**
|
||||
* @brief Specifies the requirements a Webserver handler must fulfill.
|
||||
*/
|
||||
// clang-format off
|
||||
template <typename T>
|
||||
concept SomeServerHandler = requires(T handler, std::string req, std::shared_ptr<ConnectionBase> ws, boost::beast::error_code ec) {
|
||||
// the callback when server receives a request
|
||||
{ handler(req, ws) };
|
||||
// the callback when there is an error
|
||||
{ handler(ec, ws) };
|
||||
};
|
||||
// clang-format on
|
||||
concept SomeServerHandler =
|
||||
requires(T handler, std::string req, std::shared_ptr<ConnectionBase> ws, boost::beast::error_code ec) {
|
||||
// the callback when server receives a request
|
||||
{
|
||||
handler(req, ws)
|
||||
};
|
||||
// the callback when there is an error
|
||||
{
|
||||
handler(ec, ws)
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace web
|
||||
|
||||
@@ -33,8 +33,7 @@ namespace http = boost::beast::http;
|
||||
*
|
||||
* This class is used to represent a connection in RPC executor and subscription manager.
|
||||
*/
|
||||
struct ConnectionBase : public util::Taggable
|
||||
{
|
||||
struct ConnectionBase : public util::Taggable {
|
||||
protected:
|
||||
boost::system::error_code ec_;
|
||||
|
||||
@@ -71,7 +70,8 @@ public:
|
||||
* @param msg The message to send
|
||||
* @throws Not supported unless implemented in child classes. Will always throw std::logic_error.
|
||||
*/
|
||||
virtual void send(std::shared_ptr<std::string> /* msg */)
|
||||
virtual void
|
||||
send(std::shared_ptr<std::string> /* msg */)
|
||||
{
|
||||
throw std::logic_error("web server can not send the shared payload");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user