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
128bed47
Commit
128bed47
authored
Aug 27, 2014
by
Martin Hurton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1170 from hintjens/master
Fixed issues with xpub nodrop property
parents
81485c76
2584c3a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
.gitignore
.gitignore
+3
-0
xpub.cpp
src/xpub.cpp
+8
-7
xpub.hpp
src/xpub.hpp
+2
-2
No files found.
.gitignore
View file @
128bed47
...
@@ -95,6 +95,9 @@ tests/test_bind_src_address
...
@@ -95,6 +95,9 @@ tests/test_bind_src_address
tests/test_metadata
tests/test_metadata
tests/test_id2fd
tests/test_id2fd
tests/test_capabilities
tests/test_capabilities
tests/test_hwm_pubsub
tests/test_router_mandatory_hwm
tests/test_xpub_nodrop
tests/test*.log
tests/test*.log
tests/test*.trs
tests/test*.trs
src/platform.hpp*
src/platform.hpp*
...
...
src/xpub.cpp
View file @
128bed47
...
@@ -30,6 +30,7 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
...
@@ -30,6 +30,7 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
more
(
false
)
more
(
false
)
{
{
options
.
type
=
ZMQ_XPUB
;
options
.
type
=
ZMQ_XPUB
;
lossy
=
true
;
}
}
zmq
::
xpub_t
::~
xpub_t
()
zmq
::
xpub_t
::~
xpub_t
()
...
@@ -90,10 +91,6 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
...
@@ -90,10 +91,6 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
int
zmq
::
xpub_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
int
zmq
::
xpub_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
size_t
optvallen_
)
{
{
if
(
option_
!=
ZMQ_XPUB_VERBOSE
&&
option_
!=
ZMQ_XPUB_NODROP
)
{
errno
=
EINVAL
;
return
-
1
;
}
if
(
optvallen_
!=
sizeof
(
int
)
||
*
static_cast
<
const
int
*>
(
optval_
)
<
0
)
{
if
(
optvallen_
!=
sizeof
(
int
)
||
*
static_cast
<
const
int
*>
(
optval_
)
<
0
)
{
errno
=
EINVAL
;
errno
=
EINVAL
;
return
-
1
;
return
-
1
;
...
@@ -101,8 +98,12 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
...
@@ -101,8 +98,12 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
if
(
option_
==
ZMQ_XPUB_VERBOSE
)
if
(
option_
==
ZMQ_XPUB_VERBOSE
)
verbose
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
verbose
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
else
else
nodrop
=
(
*
static_cast
<
const
int
*>
(
optval_
)
!=
0
);
if
(
option_
==
ZMQ_XPUB_NODROP
)
lossy
=
(
*
static_cast
<
const
int
*>
(
optval_
)
==
0
);
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -131,7 +132,7 @@ int zmq::xpub_t::xsend (msg_t *msg_)
...
@@ -131,7 +132,7 @@ int zmq::xpub_t::xsend (msg_t *msg_)
subscriptions
.
match
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
(),
subscriptions
.
match
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
(),
mark_as_matching
,
this
);
mark_as_matching
,
this
);
if
(
nodrop
&&
!
dist
.
check_hwm
())
{
if
(
lossy
==
false
&&
!
dist
.
check_hwm
())
{
errno
=
EAGAIN
;
errno
=
EAGAIN
;
return
-
1
;
return
-
1
;
}
}
...
...
src/xpub.hpp
View file @
128bed47
...
@@ -79,8 +79,8 @@ namespace zmq
...
@@ -79,8 +79,8 @@ namespace zmq
// True if we are in the middle of sending a multi-part message.
// True if we are in the middle of sending a multi-part message.
bool
more
;
bool
more
;
//
dont drop messages if hwm reached, just
return with EAGAIN
//
Drop messages if HWM reached, otherwise
return with EAGAIN
bool
nodrop
;
bool
lossy
;
// List of pending (un)subscriptions, ie. those that were already
// List of pending (un)subscriptions, ie. those that were already
// applied to the trie, but not yet received by the user.
// applied to the trie, but not yet received by the user.
...
...
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