client/Internal: move CLIENT_MAX_* to class Client
This commit is contained in:
parent
38298e0cd8
commit
772aa4f165
|
@ -83,6 +83,8 @@ public:
|
|||
TagMask tag_mask = TagMask::All();
|
||||
|
||||
private:
|
||||
static constexpr size_t MAX_SUBSCRIPTIONS = 16;
|
||||
|
||||
/**
|
||||
* A list of channel names this client is subscribed to.
|
||||
*/
|
||||
|
@ -94,6 +96,8 @@ private:
|
|||
*/
|
||||
unsigned num_subscriptions = 0;
|
||||
|
||||
static constexpr size_t MAX_MESSAGES = 64;
|
||||
|
||||
/**
|
||||
* A list of messages this client has received.
|
||||
*/
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
|
||||
#include <chrono>
|
||||
|
||||
static constexpr unsigned CLIENT_MAX_SUBSCRIPTIONS = 16;
|
||||
static constexpr unsigned CLIENT_MAX_MESSAGES = 64;
|
||||
|
||||
extern std::chrono::steady_clock::duration client_timeout;
|
||||
extern size_t client_max_command_list_size;
|
||||
extern size_t client_max_output_buffer_size;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "Internal.hxx"
|
||||
#include "Client.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "Idle.hxx"
|
||||
|
||||
|
@ -31,7 +31,7 @@ Client::Subscribe(const char *channel) noexcept
|
|||
if (!client_message_valid_channel_name(channel))
|
||||
return Client::SubscribeResult::INVALID;
|
||||
|
||||
if (num_subscriptions >= CLIENT_MAX_SUBSCRIPTIONS)
|
||||
if (num_subscriptions >= MAX_SUBSCRIPTIONS)
|
||||
return Client::SubscribeResult::FULL;
|
||||
|
||||
auto r = subscriptions.insert(channel);
|
||||
|
@ -75,7 +75,7 @@ Client::UnsubscribeAll() noexcept
|
|||
bool
|
||||
Client::PushMessage(const ClientMessage &msg) noexcept
|
||||
{
|
||||
if (messages.size() >= CLIENT_MAX_MESSAGES ||
|
||||
if (messages.size() >= MAX_MESSAGES ||
|
||||
!IsSubscribed(msg.GetChannel()))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue