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
f042ea9e
Commit
f042ea9e
authored
Aug 08, 2014
by
kreuzberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better naming of flags and variables to real functionality: nodrop
parent
d9a3cc48
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
15 deletions
+15
-15
zmq.h
include/zmq.h
+1
-1
options.cpp
src/options.cpp
+4
-4
options.hpp
src/options.hpp
+2
-2
xpub.cpp
src/xpub.cpp
+4
-4
xpub.hpp
src/xpub.hpp
+2
-2
test_hwm_pubsub.cpp
tests/test_hwm_pubsub.cpp
+1
-1
test_xpub_wait_inproc.cpp
tests/test_xpub_wait_inproc.cpp
+1
-1
No files found.
include/zmq.h
View file @
f042ea9e
...
...
@@ -307,7 +307,7 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_HANDSHAKE_IVL 66
#define ZMQ_IDENTITY_FD 67
#define ZMQ_SOCKS_PROXY 68
#define ZMQ_XPUB_
WAIT
69
#define ZMQ_XPUB_
NODROP
69
/* Message options */
#define ZMQ_MORE 1
...
...
src/options.cpp
View file @
f042ea9e
...
...
@@ -458,9 +458,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return
0
;
}
break
;
case
ZMQ_XPUB_
WAIT
:
case
ZMQ_XPUB_
NODROP
:
{
pub
Wait
=
true
;
pub
_nodrop
=
true
;
return
0
;
}
break
;
...
...
@@ -811,9 +811,9 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break
;
case
ZMQ_XPUB_
WAIT
:
case
ZMQ_XPUB_
NODROP
:
if
(
is_int
)
{
*
value
=
pub
Wait
;
*
value
=
pub
_nodrop
;
return
0
;
}
break
;
...
...
src/options.hpp
View file @
f042ea9e
...
...
@@ -179,8 +179,8 @@ namespace zmq
// close socket. Default is 30 secs. 0 means no handshake timeout.
int
handshake_ivl
;
// flag if PUB socket should
block
if reaching HWM
bool
pub
Wait
;
// flag if PUB socket should
not drop messages
if reaching HWM
bool
pub
_nodrop
;
};
}
...
...
src/xpub.cpp
View file @
f042ea9e
...
...
@@ -90,7 +90,7 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
int
zmq
::
xpub_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
{
if
(
option_
!=
ZMQ_XPUB_VERBOSE
&&
option_
!=
ZMQ_XPUB_
WAIT
)
{
if
(
option_
!=
ZMQ_XPUB_VERBOSE
&&
option_
!=
ZMQ_XPUB_
NODROP
)
{
errno
=
EINVAL
;
return
-
1
;
}
...
...
@@ -100,8 +100,8 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
}
if
(
option_
==
ZMQ_XPUB_VERBOSE
)
{
verbose
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
}
else
if
(
option_
==
ZMQ_XPUB_
WAIT
)
{
wait
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
}
else
if
(
option_
==
ZMQ_XPUB_
NODROP
)
{
nodrop
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
}
else
{
return
-
1
;
...
...
@@ -135,7 +135,7 @@ int zmq::xpub_t::xsend (msg_t *msg_)
subscriptions
.
match
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
(),
mark_as_matching
,
this
);
if
(
wait
&&
!
dist
.
check_hwm
())
{
if
(
nodrop
&&
!
dist
.
check_hwm
())
{
return
EAGAIN
;
}
...
...
src/xpub.hpp
View file @
f042ea9e
...
...
@@ -79,8 +79,8 @@ namespace zmq
// True if we are in the middle of sending a multi-part message.
bool
more
;
//
wait for reaching LWM if HWM is reached
bool
wait
;
//
dont drop messages if hwm reached, just return with EAGAIN
bool
nodrop
;
// List of pending (un)subscriptions, ie. those that were already
// applied to the trie, but not yet received by the user.
...
...
tests/test_hwm_pubsub.cpp
View file @
f042ea9e
...
...
@@ -105,7 +105,7 @@ int test_blocking (int send_hwm, int msgCnt)
//set a hwm on publisher
rc
=
zmq_setsockopt
(
pub_socket
,
ZMQ_SNDHWM
,
&
send_hwm
,
sizeof
(
send_hwm
));
int
wait
=
1
;
rc
=
zmq_setsockopt
(
pub_socket
,
ZMQ_XPUB_
WAIT
,
&
wait
,
sizeof
(
wait
));
rc
=
zmq_setsockopt
(
pub_socket
,
ZMQ_XPUB_
NODROP
,
&
wait
,
sizeof
(
wait
));
rc
=
zmq_setsockopt
(
sub_socket
,
ZMQ_SUBSCRIBE
,
0
,
0
);
// Send until we block
...
...
tests/test_xpub_wait_inproc.cpp
View file @
f042ea9e
...
...
@@ -33,7 +33,7 @@ int main (void)
// set pub socket options
int
wait
=
1
;
rc
=
zmq_setsockopt
(
pub
,
ZMQ_XPUB_
WAIT
,
&
wait
,
4
);
rc
=
zmq_setsockopt
(
pub
,
ZMQ_XPUB_
NODROP
,
&
wait
,
4
);
assert
(
rc
==
0
);
int
hwm
=
2000
;
...
...
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