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
a348d94c
Commit
a348d94c
authored
Jan 14, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fair queueing of subscriptions added to XPUB socket
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
58c9830d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
xpub.cpp
src/xpub.cpp
+16
-3
xpub.hpp
src/xpub.hpp
+6
-0
No files found.
src/xpub.cpp
View file @
a348d94c
...
...
@@ -25,10 +25,11 @@
zmq
::
xpub_t
::
xpub_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
)
:
socket_base_t
(
parent_
,
tid_
),
dist
(
this
)
dist
(
this
),
fq
(
this
)
{
options
.
type
=
ZMQ_XPUB
;
options
.
requires_in
=
fals
e
;
options
.
requires_in
=
tru
e
;
options
.
requires_out
=
true
;
}
...
...
@@ -39,14 +40,16 @@ zmq::xpub_t::~xpub_t ()
void
zmq
::
xpub_t
::
xattach_pipes
(
class
reader_t
*
inpipe_
,
class
writer_t
*
outpipe_
,
const
blob_t
&
peer_identity_
)
{
zmq_assert
(
!
in
pipe_
);
zmq_assert
(
inpipe_
&&
out
pipe_
);
dist
.
attach
(
outpipe_
);
fq
.
attach
(
inpipe_
);
}
void
zmq
::
xpub_t
::
process_term
(
int
linger_
)
{
// Terminate the outbound pipes.
dist
.
terminate
();
fq
.
terminate
();
// Continue with the termination immediately.
socket_base_t
::
process_term
(
linger_
);
...
...
@@ -62,3 +65,13 @@ bool zmq::xpub_t::xhas_out ()
return
dist
.
has_out
();
}
int
zmq
::
xpub_t
::
xrecv
(
zmq_msg_t
*
msg_
,
int
flags_
)
{
return
fq
.
recv
(
msg_
,
flags_
);
}
bool
zmq
::
xpub_t
::
xhas_in
()
{
return
fq
.
has_in
();
}
src/xpub.hpp
View file @
a348d94c
...
...
@@ -24,6 +24,7 @@
#include "array.hpp"
#include "pipe.hpp"
#include "dist.hpp"
#include "fq.hpp"
namespace
zmq
{
...
...
@@ -40,6 +41,8 @@ namespace zmq
const
blob_t
&
peer_identity_
);
int
xsend
(
zmq_msg_t
*
msg_
,
int
flags_
);
bool
xhas_out
();
int
xrecv
(
zmq_msg_t
*
msg_
,
int
flags_
);
bool
xhas_in
();
private
:
...
...
@@ -49,6 +52,9 @@ namespace zmq
// Distributor of messages holding the list of outbound pipes.
dist_t
dist
;
// Fair queuer for inbound subscriptions.
fq_t
fq
;
xpub_t
(
const
xpub_t
&
);
const
xpub_t
&
operator
=
(
const
xpub_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