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
c33cb38a
Unverified
Commit
c33cb38a
authored
Feb 09, 2018
by
Luca Boccassi
Committed by
GitHub
Feb 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2928 from eponsko/master
Add support for ZMQ_XPUB_NODROP on ZMQ_RADIO sockets
parents
eded1f8b
a57f7e38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
radio.cpp
src/radio.cpp
+25
-2
radio.hpp
src/radio.hpp
+4
-0
No files found.
src/radio.cpp
View file @
c33cb38a
...
...
@@ -37,7 +37,8 @@
#include "msg.hpp"
zmq
::
radio_t
::
radio_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
)
:
socket_base_t
(
parent_
,
tid_
,
sid_
,
true
)
socket_base_t
(
parent_
,
tid_
,
sid_
,
true
),
lossy
(
true
)
{
options
.
type
=
ZMQ_RADIO
;
}
...
...
@@ -99,6 +100,22 @@ void zmq::radio_t::xwrite_activated (pipe_t *pipe_)
{
dist
.
activated
(
pipe_
);
}
int
zmq
::
radio_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
{
if
(
optvallen_
!=
sizeof
(
int
)
||
*
static_cast
<
const
int
*>
(
optval_
)
<
0
)
{
errno
=
EINVAL
;
return
-
1
;
}
if
(
option_
==
ZMQ_XPUB_NODROP
)
lossy
=
(
*
static_cast
<
const
int
*>
(
optval_
)
==
0
);
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
}
void
zmq
::
radio_t
::
xpipe_terminated
(
pipe_t
*
pipe_
)
{
...
...
@@ -141,7 +158,13 @@ int zmq::radio_t::xsend (msg_t *msg_)
++
it
)
dist
.
match
(
*
it
);
int
rc
=
dist
.
send_to_matching
(
msg_
);
int
rc
=
-
1
;
if
(
lossy
||
dist
.
check_hwm
())
{
if
(
dist
.
send_to_matching
(
msg_
)
==
0
)
{
rc
=
0
;
// Yay, sent successfully
}
}
else
errno
=
EAGAIN
;
return
rc
;
}
...
...
src/radio.hpp
View file @
c33cb38a
...
...
@@ -61,6 +61,7 @@ class radio_t : public socket_base_t
bool
xhas_in
();
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
private
:
...
...
@@ -75,6 +76,9 @@ class radio_t : public socket_base_t
// Distributor of messages holding the list of outbound pipes.
dist_t
dist
;
// Drop messages if HWM reached, otherwise return with EAGAIN
bool
lossy
;
radio_t
(
const
radio_t
&
);
const
radio_t
&
operator
=
(
const
radio_t
&
);
};
...
...
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