diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-21 21:18:28 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-22 11:13:20 +0800 |
| commit | 2320470d342db4cb5ae0ae717dfc5ac94bd3f2d2 (patch) | |
| tree | a20a988ea60284374865405118bf38324b1a368a /include/libsock/server/clients.hpp | |
| parent | 3e11125a1694d61fb0bd578783437acfca8eacc3 (diff) | |
internal(server): remove return of std::any for callbacks
use bool for cases for premature return
Diffstat (limited to 'include/libsock/server/clients.hpp')
| -rw-r--r-- | include/libsock/server/clients.hpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/libsock/server/clients.hpp b/include/libsock/server/clients.hpp index 9e08797..d8c1921 100644 --- a/include/libsock/server/clients.hpp +++ b/include/libsock/server/clients.hpp @@ -2,7 +2,6 @@ #include "../types.hpp" #include "server.hpp" -#include <any> #include <functional> #include <memory> #include <optional> @@ -25,14 +24,14 @@ class Clients : public std::enable_shared_from_this<Clients> { static SP<Clients> create(); ~Clients(); - WP<Client> newClient(std::function<std::any(const WP<Client> &)> loopFunc = [](const WP<Client> &) { return std::any(); }, SP<Server> server = pServer); + WP<Client> newClient(std::function<void(const WP<Client> &)> loopFunc = [](const WP<Client> &) { ; }, SP<Server> server = pServer); void broadcast(const std::string &msg, std::optional<WP<Client>> self = std::nullopt); // second param only specified when we // want to exclude the sender - void kick(WP<Client> client, const bool kill = false, const std::string &reason = "", std::optional<std::function<std::any(const std::vector<std::pair<std::jthread, SP<Client>>>::iterator &)>> cb = std::nullopt); + void kick(WP<Client> client, const bool kill = false, const std::string &reason = "", std::optional<std::function<bool(const std::vector<std::pair<std::jthread, SP<Client>>>::iterator &)>> cb = std::nullopt); void addClient(const Client &client); - void shutdownClients(std::optional<std::function<std::any(const std::vector<std::pair<std::jthread, SP<Client>>> &)>> cb = std::nullopt); + void shutdownClients(std::optional<std::function<bool(const std::vector<std::pair<std::jthread, SP<Client>>> &)>> cb = std::nullopt); SP<Client> getByIp(const std::string &ip) const; std::vector<SP<Client>> getClients() const; |
