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
a53dfe93
Commit
a53dfe93
authored
May 18, 2019
by
Luca Boccassi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: many unnecessary ifdefs covering new xpub option
Solution: remove them, only public headers have to be ifdef'd
parent
9bcfc251
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
17 deletions
+2
-17
xpub.cpp
src/xpub.cpp
+2
-15
xpub.hpp
src/xpub.hpp
+0
-2
No files found.
src/xpub.cpp
View file @
a53dfe93
...
...
@@ -44,9 +44,7 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
_more
(
false
),
_lossy
(
true
),
_manual
(
false
),
#ifdef ZMQ_BUILD_DRAFT_API
_send_last_pipe
(
false
),
#endif
_pending_pipes
(),
_welcome_msg
()
{
...
...
@@ -193,10 +191,8 @@ int zmq::xpub_t::xsetsockopt (int option_,
size_t
optvallen_
)
{
if
(
option_
==
ZMQ_XPUB_VERBOSE
||
option_
==
ZMQ_XPUB_VERBOSER
#ifdef ZMQ_BUILD_DRAFT_API
||
option_
==
ZMQ_XPUB_MANUAL_LAST_VALUE
#endif
||
option_
==
ZMQ_XPUB_NODROP
||
option_
==
ZMQ_XPUB_MANUAL
)
{
||
option_
==
ZMQ_XPUB_MANUAL_LAST_VALUE
||
option_
==
ZMQ_XPUB_NODROP
||
option_
==
ZMQ_XPUB_MANUAL
)
{
if
(
optvallen_
!=
sizeof
(
int
)
||
*
static_cast
<
const
int
*>
(
optval_
)
<
0
)
{
errno
=
EINVAL
;
...
...
@@ -208,11 +204,9 @@ int zmq::xpub_t::xsetsockopt (int option_,
}
else
if
(
option_
==
ZMQ_XPUB_VERBOSER
)
{
_verbose_subs
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
_verbose_unsubs
=
_verbose_subs
;
#ifdef ZMQ_BUILD_DRAFT_API
}
else
if
(
option_
==
ZMQ_XPUB_MANUAL_LAST_VALUE
)
{
_manual
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
_send_last_pipe
=
_manual
;
#endif
}
else
if
(
option_
==
ZMQ_XPUB_NODROP
)
_lossy
=
(
*
static_cast
<
const
int
*>
(
optval_
)
==
0
);
else
if
(
option_
==
ZMQ_XPUB_MANUAL
)
...
...
@@ -276,13 +270,11 @@ void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, xpub_t *self_)
self_
->
_dist
.
match
(
pipe_
);
}
#ifdef ZMQ_BUILD_DRAFT_API
void
zmq
::
xpub_t
::
mark_last_pipe_as_matching
(
pipe_t
*
pipe_
,
xpub_t
*
self_
)
{
if
(
self_
->
_last_pipe
==
pipe_
)
self_
->
_dist
.
match
(
pipe_
);
}
#endif
int
zmq
::
xpub_t
::
xsend
(
msg_t
*
msg_
)
{
...
...
@@ -290,7 +282,6 @@ int zmq::xpub_t::xsend (msg_t *msg_)
// For the first part of multi-part message, find the matching pipes.
if
(
!
_more
)
{
#ifdef ZMQ_BUILD_DRAFT_API
if
(
_manual
&&
_last_pipe
&&
_send_last_pipe
)
{
_subscriptions
.
match
(
static_cast
<
unsigned
char
*>
(
msg_
->
data
()),
msg_
->
size
(),
mark_last_pipe_as_matching
,
...
...
@@ -299,10 +290,6 @@ int zmq::xpub_t::xsend (msg_t *msg_)
}
else
_subscriptions
.
match
(
static_cast
<
unsigned
char
*>
(
msg_
->
data
()),
msg_
->
size
(),
mark_as_matching
,
this
);
#else
_subscriptions
.
match
(
static_cast
<
unsigned
char
*>
(
msg_
->
data
()),
msg_
->
size
(),
mark_as_matching
,
this
);
#endif
// If inverted matching is used, reverse the selection now
if
(
options
.
invert_matching
)
{
_dist
.
reverse_match
();
...
...
src/xpub.hpp
View file @
a53dfe93
...
...
@@ -99,13 +99,11 @@ class xpub_t : public socket_base_t
// Subscriptions will not bed added automatically, only after calling set option with ZMQ_SUBSCRIBE or ZMQ_UNSUBSCRIBE
bool
_manual
;
#ifdef ZMQ_BUILD_DRAFT_API
// Send message to the last pipe, only used if xpub is on manual and after calling set option with ZMQ_SUBSCRIBE
bool
_send_last_pipe
;
// Function to be applied to match the last pipe.
static
void
mark_last_pipe_as_matching
(
zmq
::
pipe_t
*
pipe_
,
xpub_t
*
arg_
);
#endif
// Last pipe that sent subscription message, only used if xpub is on manual
pipe_t
*
_last_pipe
;
...
...
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