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
826e7db7
Unverified
Commit
826e7db7
authored
Sep 02, 2019
by
Doron Somech
Committed by
GitHub
Sep 02, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3659 from bluca/xpub_user_msg
Problem: can no longer send user data from XSUB to XPUB
parents
c737e572
6fb8ef07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
xpub.cpp
src/xpub.cpp
+4
-7
test_xpub_manual.cpp
tests/test_xpub_manual.cpp
+23
-0
No files found.
src/xpub.cpp
View file @
826e7db7
...
@@ -104,13 +104,10 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
...
@@ -104,13 +104,10 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
data
=
static_cast
<
unsigned
char
*>
(
sub
.
command_body
());
data
=
static_cast
<
unsigned
char
*>
(
sub
.
command_body
());
size
=
sub
.
command_body_size
();
size
=
sub
.
command_body_size
();
subscribe
=
sub
.
is_subscribe
();
subscribe
=
sub
.
is_subscribe
();
}
else
if
(
sub
.
size
()
>
0
)
{
}
else
if
(
sub
.
size
()
>
0
&&
(
*
msg_data
==
0
||
*
msg_data
==
1
))
{
unsigned
char
first
=
*
msg_data
;
data
=
msg_data
+
1
;
if
(
first
==
0
||
first
==
1
)
{
size
=
sub
.
size
()
-
1
;
data
=
msg_data
+
1
;
subscribe
=
*
msg_data
==
1
;
size
=
sub
.
size
()
-
1
;
subscribe
=
first
==
1
;
}
}
else
{
}
else
{
// Process user message coming upstream from xsub socket
// Process user message coming upstream from xsub socket
_pending_data
.
push_back
(
blob_t
(
msg_data
,
sub
.
size
()));
_pending_data
.
push_back
(
blob_t
(
msg_data
,
sub
.
size
()));
...
...
tests/test_xpub_manual.cpp
View file @
826e7db7
...
@@ -434,6 +434,28 @@ void test_unsubscribe_cleanup ()
...
@@ -434,6 +434,28 @@ void test_unsubscribe_cleanup ()
test_context_socket_close
(
sub
);
test_context_socket_close
(
sub
);
}
}
void
test_user_message
()
{
// Create a publisher
void
*
pub
=
test_context_socket
(
ZMQ_XPUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
pub
,
"inproc://soname"
));
// Create a subscriber
void
*
sub
=
test_context_socket
(
ZMQ_XSUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sub
,
"inproc://soname"
));
// Send some data that is neither sub nor unsub
const
char
subscription
[]
=
{
2
,
'A'
,
0
};
send_string_expect_success
(
sub
,
subscription
,
0
);
// Receive subscriptions from subscriber
recv_string_expect_success
(
pub
,
subscription
,
0
);
// Clean up.
test_context_socket_close
(
pub
);
test_context_socket_close
(
sub
);
}
int
main
()
int
main
()
{
{
setup_test_environment
();
setup_test_environment
();
...
@@ -444,6 +466,7 @@ int main ()
...
@@ -444,6 +466,7 @@ int main ()
RUN_TEST
(
test_xpub_proxy_unsubscribe_on_disconnect
);
RUN_TEST
(
test_xpub_proxy_unsubscribe_on_disconnect
);
RUN_TEST
(
test_missing_subscriptions
);
RUN_TEST
(
test_missing_subscriptions
);
RUN_TEST
(
test_unsubscribe_cleanup
);
RUN_TEST
(
test_unsubscribe_cleanup
);
RUN_TEST
(
test_user_message
);
return
UNITY_END
();
return
UNITY_END
();
}
}
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