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
b7f2c7e7
Commit
b7f2c7e7
authored
Oct 29, 2016
by
Dave Olszewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increment metadata refcount while it's in pending_metadata
parent
16f58474
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
xpub.cpp
src/xpub.cpp
+12
-3
No files found.
src/xpub.cpp
View file @
b7f2c7e7
...
...
@@ -89,6 +89,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// Apply the subscription to the trie
unsigned
char
*
const
data
=
(
unsigned
char
*
)
sub
.
data
();
const
size_t
size
=
sub
.
size
();
metadata_t
*
metadata
=
sub
.
metadata
();
if
(
size
>
0
&&
(
*
data
==
0
||
*
data
==
1
))
{
if
(
manual
)
{
...
...
@@ -100,7 +101,9 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
pending_pipes
.
push_back
(
pipe_
);
pending_data
.
push_back
(
blob_t
(
data
,
size
));
pending_metadata
.
push_back
(
sub
.
metadata
());
if
(
metadata
)
metadata
->
add_ref
();
pending_metadata
.
push_back
(
metadata
);
pending_flags
.
push_back
(
0
);
}
else
...
...
@@ -117,7 +120,9 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
if
(
options
.
type
==
ZMQ_XPUB
&&
(
unique
||
(
*
data
==
1
&&
verbose_subs
)
||
(
*
data
==
0
&&
verbose_unsubs
&&
verbose_subs
)))
{
pending_data
.
push_back
(
blob_t
(
data
,
size
));
pending_metadata
.
push_back
(
sub
.
metadata
());
if
(
metadata
)
metadata
->
add_ref
();
pending_metadata
.
push_back
(
metadata
);
pending_flags
.
push_back
(
0
);
}
}
...
...
@@ -125,7 +130,9 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
else
{
// Process user message coming upstream from xsub socket
pending_data
.
push_back
(
blob_t
(
data
,
size
));
pending_metadata
.
push_back
(
sub
.
metadata
());
if
(
metadata
)
metadata
->
add_ref
();
pending_metadata
.
push_back
(
metadata
);
pending_flags
.
push_back
(
sub
.
flags
());
}
sub
.
close
();
...
...
@@ -280,6 +287,8 @@ int zmq::xpub_t::xrecv (msg_t *msg_)
// set metadata only if there is some
if
(
metadata_t
*
metadata
=
pending_metadata
.
front
())
{
msg_
->
set_metadata
(
metadata
);
// Remove ref corresponding to vector placement
metadata
->
drop_ref
();
}
msg_
->
set_flags
(
pending_flags
.
front
());
...
...
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