deprecate ForEachClientWeak in favor of new ForEachClient

This commit is contained in:
Lion Kortlepel
2022-11-13 12:57:09 +01:00
parent a8ad9034b2
commit d7369c3bc5
9 changed files with 43 additions and 19 deletions

View File

@@ -0,0 +1,6 @@
#pragma once
enum IterationDecision {
Continue,
Break,
};

View File

@@ -1,6 +1,7 @@
#pragma once
#include "IThreaded.h"
#include "IterationDecision.h"
#include "RWMutex.h"
#include "TScopedTimer.h"
#include <functional>
@@ -23,7 +24,9 @@ public:
void InsertClient(const std::shared_ptr<TClient>& Ptr);
void RemoveClient(const std::weak_ptr<TClient>&);
// in Fn, return true to continue, return false to break
void ForEachClient(const std::function<bool(std::weak_ptr<TClient>)>& Fn);
[[deprecated("use ForEachClient instead")]] void ForEachClientWeak(const std::function<bool(std::weak_ptr<TClient>)>& Fn);
// in Fn, return Break or Continue
void ForEachClient(const std::function<IterationDecision(const std::shared_ptr<TClient>&)>& Fn);
size_t ClientCount() const;
static void GlobalParser(const std::weak_ptr<TClient>& Client, std::vector<uint8_t>&& Packet, TNetwork& Network);