std::unique_ptr<Connection> -> Ref<Connection>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
|
||||
#include "reference.hpp"
|
||||
|
||||
// Forward declaration to avoid circular dependency
|
||||
struct Connection;
|
||||
|
||||
@@ -39,8 +40,7 @@ public:
|
||||
* after the call to on_data_arrived.
|
||||
* @note May be called from an arbitrary server thread.
|
||||
*/
|
||||
virtual void on_data_arrived(std::string_view /*data*/,
|
||||
std::unique_ptr<Connection> &) {};
|
||||
virtual void on_data_arrived(std::string_view /*data*/, Ref<Connection> &) {};
|
||||
|
||||
/**
|
||||
* Called when data has been successfully written to the connection.
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
* @note May be called from an arbitrary server thread.
|
||||
* @note Called during writes, not necessarily when buffer becomes empty
|
||||
*/
|
||||
virtual void on_write_progress(std::unique_ptr<Connection> &) {}
|
||||
virtual void on_write_progress(Ref<Connection> &) {}
|
||||
|
||||
/**
|
||||
* Called when the connection's outgoing write buffer becomes empty.
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
* @note May be called from an arbitrary server thread.
|
||||
* @note Only called on transitions from non-empty → empty buffer
|
||||
*/
|
||||
virtual void on_write_buffer_drained(std::unique_ptr<Connection> &) {}
|
||||
virtual void on_write_buffer_drained(Ref<Connection> &) {}
|
||||
|
||||
/**
|
||||
* Called when a new connection is established.
|
||||
@@ -107,6 +107,5 @@ public:
|
||||
*
|
||||
* @param batch A span of unique_ptrs to the connections in the batch.
|
||||
*/
|
||||
virtual void
|
||||
on_batch_complete(std::span<std::unique_ptr<Connection>> /*batch*/) {}
|
||||
virtual void on_batch_complete(std::span<Ref<Connection>> /*batch*/) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user