Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
772aa4f1
Commit
772aa4f1
authored
Apr 03, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client/Internal: move CLIENT_MAX_* to class Client
parent
38298e0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
Client.hxx
src/client/Client.hxx
+4
-0
Internal.hxx
src/client/Internal.hxx
+0
-3
Subscribe.cxx
src/client/Subscribe.cxx
+3
-3
No files found.
src/client/Client.hxx
View file @
772aa4f1
...
...
@@ -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.
*/
...
...
src/client/Internal.hxx
View file @
772aa4f1
...
...
@@ -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
;
...
...
src/client/Subscribe.cxx
View file @
772aa4f1
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment