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
a7808336
Commit
a7808336
authored
Oct 17, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZMQ_BACKLOG socket option added.
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
e8e2944f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
11 deletions
+59
-11
zmq_getsockopt.txt
doc/zmq_getsockopt.txt
+13
-0
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+13
-0
zmq.h
include/zmq.h
+1
-0
config.hpp
src/config.hpp
+0
-4
options.cpp
src/options.cpp
+19
-0
options.hpp
src/options.hpp
+3
-0
tcp_listener.cpp
src/tcp_listener.cpp
+7
-5
tcp_listener.hpp
src/tcp_listener.hpp
+2
-1
zmq_listener.cpp
src/zmq_listener.cpp
+1
-1
No files found.
doc/zmq_getsockopt.txt
View file @
a7808336
...
...
@@ -239,6 +239,19 @@ Default value:: 100
Applicable socket types:: all
ZMQ_BACKLOG: Retrieve maximum length of the queue of pending connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT' option shall retrieve maximum size of the
pending connection backlog for connection-based transports. For details
refer to your operating system documentation for the 'listen' function.
[horizontal]
Option value type:: int
Option value unit:: connections
Default value:: 100
Applicable socket types:: all
ZMQ_FD: Retrieve file descriptor associated with the socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_FD' option shall retrieve file descriptor associated with the 0MQ
...
...
doc/zmq_setsockopt.txt
View file @
a7808336
...
...
@@ -245,6 +245,19 @@ Default value:: 100
Applicable socket types:: all
ZMQ_BACKLOG: Set maximum length of the queue of pending connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT' option shall be set to specify maximum size of the
pending connection backlog for connection-based transports. For details
refer to your operating system documentation for the 'listen' function.
[horizontal]
Option value type:: int
Option value unit:: connections
Default value:: 100
Applicable socket types:: all
RETURN VALUE
------------
The _zmq_setsockopt()_ function shall return zero if successful. Otherwise it
...
...
include/zmq.h
View file @
a7808336
...
...
@@ -193,6 +193,7 @@ ZMQ_EXPORT int zmq_term (void *context);
#define ZMQ_TYPE 16
#define ZMQ_LINGER 17
#define ZMQ_RECONNECT_IVL 18
#define ZMQ_BACKLOG 19
/* Send/recv options. */
#define ZMQ_NOBLOCK 1
...
...
src/config.hpp
View file @
a7808336
...
...
@@ -85,10 +85,6 @@ namespace zmq
// possible latencies.
clock_precision
=
1000000
,
// Maximal number of non-accepted connections that can be held by
// TCP listener object.
tcp_connection_backlog
=
100
,
// Maximum transport data unit size for PGM (TPDU).
pgm_max_tpdu
=
1500
};
...
...
src/options.cpp
View file @
a7808336
...
...
@@ -36,6 +36,7 @@ zmq::options_t::options_t () :
type
(
-
1
),
linger
(
-
1
),
reconnect_ivl
(
100
),
backlog
(
100
),
requires_in
(
false
),
requires_out
(
false
),
immediate_connect
(
true
)
...
...
@@ -150,6 +151,15 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
reconnect_ivl
=
*
((
int
*
)
optval_
);
return
0
;
case
ZMQ_BACKLOG
:
if
(
optvallen_
!=
sizeof
(
int
))
{
errno
=
EINVAL
;
return
-
1
;
}
backlog
=
*
((
int
*
)
optval_
);
return
0
;
}
errno
=
EINVAL
;
...
...
@@ -269,6 +279,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*
optvallen_
=
sizeof
(
int
);
return
0
;
case
ZMQ_BACKLOG
:
if
(
*
optvallen_
<
sizeof
(
int
))
{
errno
=
EINVAL
;
return
-
1
;
}
*
((
int
*
)
optval_
)
=
backlog
;
*
optvallen_
=
sizeof
(
int
);
return
0
;
}
errno
=
EINVAL
;
...
...
src/options.hpp
View file @
a7808336
...
...
@@ -60,6 +60,9 @@ namespace zmq
// Interval between attempts to reconnect, in milliseconds.
int
reconnect_ivl
;
// Maximum backlog for pending connections.
int
backlog
;
// These options are never set by the user directly. Instead they are
// provided by the specific socket type.
bool
requires_in
;
...
...
src/tcp_listener.cpp
View file @
a7808336
...
...
@@ -42,7 +42,8 @@ zmq::tcp_listener_t::~tcp_listener_t ()
close
();
}
int
zmq
::
tcp_listener_t
::
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
)
int
zmq
::
tcp_listener_t
::
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
,
int
backlog_
)
{
// IPC protocol is not supported on Windows platform.
if
(
strcmp
(
protocol_
,
"tcp"
)
!=
0
)
{
...
...
@@ -81,7 +82,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
}
// Listen for incomming connections.
rc
=
listen
(
s
,
1
);
rc
=
listen
(
s
,
backlog_
);
if
(
rc
==
SOCKET_ERROR
)
{
wsa_error_to_errno
();
return
-
1
;
...
...
@@ -161,7 +162,8 @@ zmq::tcp_listener_t::~tcp_listener_t ()
close
();
}
int
zmq
::
tcp_listener_t
::
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
)
int
zmq
::
tcp_listener_t
::
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
,
int
backlog_
)
{
if
(
strcmp
(
protocol_
,
"tcp"
)
==
0
)
{
...
...
@@ -201,7 +203,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
}
// Listen for incomming connections.
rc
=
listen
(
s
,
tcp_connection_backlog
);
rc
=
listen
(
s
,
backlog_
);
if
(
rc
!=
0
)
{
close
();
return
-
1
;
...
...
@@ -241,7 +243,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
}
// Listen for incomming connections.
rc
=
listen
(
s
,
tcp_connection_backlog
);
rc
=
listen
(
s
,
backlog_
);
if
(
rc
!=
0
)
{
close
();
return
-
1
;
...
...
src/tcp_listener.hpp
View file @
a7808336
...
...
@@ -36,7 +36,8 @@ namespace zmq
~
tcp_listener_t
();
// Start listening on the interface.
int
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
);
int
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
,
int
backlog_
);
// Close the listening socket.
int
close
();
...
...
src/zmq_listener.cpp
View file @
a7808336
...
...
@@ -38,7 +38,7 @@ zmq::zmq_listener_t::~zmq_listener_t ()
int
zmq
::
zmq_listener_t
::
set_address
(
const
char
*
protocol_
,
const
char
*
addr_
)
{
return
tcp_listener
.
set_address
(
protocol_
,
addr_
);
return
tcp_listener
.
set_address
(
protocol_
,
addr_
,
options
.
backlog
);
}
void
zmq
::
zmq_listener_t
::
process_plug
()
...
...
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