Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
1e9ea54b
Commit
1e9ea54b
authored
Feb 13, 2014
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #889 from olafmandel/MAX_SOCKETS_MAX
Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
parents
af42d439
5815b768
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
1 deletion
+20
-1
zmq_ctx_get.txt
doc/zmq_ctx_get.txt
+5
-0
zmq_ctx_set.txt
doc/zmq_ctx_set.txt
+2
-1
zmq.h
include/zmq.h
+1
-0
ctx.cpp
src/ctx.cpp
+4
-0
test_ctx_options.cpp
tests/test_ctx_options.cpp
+8
-0
No files found.
doc/zmq_ctx_get.txt
View file @
1e9ea54b
...
@@ -31,6 +31,11 @@ ZMQ_MAX_SOCKETS: Get maximum number of sockets
...
@@ -31,6 +31,11 @@ ZMQ_MAX_SOCKETS: Get maximum number of sockets
The 'ZMQ_MAX_SOCKETS' argument returns the maximum number of sockets
The 'ZMQ_MAX_SOCKETS' argument returns the maximum number of sockets
allowed for this context.
allowed for this context.
ZMQ_MAX_SOCKETS_MAX: Get largest configurable number of sockets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_MAX_SOCKETS_MAX' argument returns the largest number of sockets
that linkzmq:zmq_ctx_set[3] will accept.
ZMQ_IPV6: Set IPv6 option
ZMQ_IPV6: Set IPv6 option
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IPV6' argument returns the IPv6 option for the context.
The 'ZMQ_IPV6' argument returns the IPv6 option for the context.
...
...
doc/zmq_ctx_set.txt
View file @
1e9ea54b
...
@@ -35,7 +35,8 @@ Default value:: 1
...
@@ -35,7 +35,8 @@ Default value:: 1
ZMQ_MAX_SOCKETS: Set maximum number of sockets
ZMQ_MAX_SOCKETS: Set maximum number of sockets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_MAX_SOCKETS' argument sets the maximum number of sockets allowed
The 'ZMQ_MAX_SOCKETS' argument sets the maximum number of sockets allowed
on the context.
on the context. You can query the maximal allowed value with
linkzmq:zmq_ctx_get[3] using 'option_name' set to 'ZMQ_MAX_SOCKETS_MAX'.
[horizontal]
[horizontal]
Default value:: 1024
Default value:: 1024
...
...
include/zmq.h
View file @
1e9ea54b
...
@@ -178,6 +178,7 @@ ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
...
@@ -178,6 +178,7 @@ ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
/* Context options */
/* Context options */
#define ZMQ_IO_THREADS 1
#define ZMQ_IO_THREADS 1
#define ZMQ_MAX_SOCKETS 2
#define ZMQ_MAX_SOCKETS 2
#define ZMQ_MAX_SOCKETS_MAX 3
/* Default for new contexts */
/* Default for new contexts */
#define ZMQ_IO_THREADS_DFLT 1
#define ZMQ_IO_THREADS_DFLT 1
...
...
src/ctx.cpp
View file @
1e9ea54b
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <unistd.h>
#endif
#endif
#include <limits>
#include <new>
#include <new>
#include <string.h>
#include <string.h>
...
@@ -204,6 +205,9 @@ int zmq::ctx_t::get (int option_)
...
@@ -204,6 +205,9 @@ int zmq::ctx_t::get (int option_)
if
(
option_
==
ZMQ_MAX_SOCKETS
)
if
(
option_
==
ZMQ_MAX_SOCKETS
)
rc
=
max_sockets
;
rc
=
max_sockets
;
else
else
if
(
option_
==
ZMQ_MAX_SOCKETS_MAX
)
rc
=
clipped_maxsocket
(
std
::
numeric_limits
<
int
>::
max
());
else
if
(
option_
==
ZMQ_IO_THREADS
)
if
(
option_
==
ZMQ_IO_THREADS
)
rc
=
io_thread_count
;
rc
=
io_thread_count
;
else
else
...
...
tests/test_ctx_options.cpp
View file @
1e9ea54b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <limits>
#include "testutil.hpp"
#include "testutil.hpp"
int
main
(
void
)
int
main
(
void
)
...
@@ -29,6 +30,13 @@ int main (void)
...
@@ -29,6 +30,13 @@ int main (void)
assert
(
ctx
);
assert
(
ctx
);
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_MAX_SOCKETS
)
==
ZMQ_MAX_SOCKETS_DFLT
);
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_MAX_SOCKETS
)
==
ZMQ_MAX_SOCKETS_DFLT
);
#if defined(ZMQ_USE_SELECT)
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_MAX_SOCKETS_MAX
)
==
ZMQ_MAX_SOCKETS_DFLT
);
#elif defined(ZMQ_USE_POLL) || defined(ZMQ_USE_EPOLL) \
|| defined(ZMQ_USE_DEVPOLL) || defined(ZMQ_USE_KQUEUE)
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_MAX_SOCKETS_MAX
)
==
std
::
numeric_limits
<
int
>::
max
());
#endif
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_IO_THREADS
)
==
ZMQ_IO_THREADS_DFLT
);
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_IO_THREADS
)
==
ZMQ_IO_THREADS_DFLT
);
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_IPV6
)
==
0
);
assert
(
zmq_ctx_get
(
ctx
,
ZMQ_IPV6
)
==
0
);
...
...
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