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
7d475add
Commit
7d475add
authored
Jan 08, 2013
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #495 from hintjens/master
Whitespace and comment cleanups
parents
c1f76e43
d997d880
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
39 deletions
+33
-39
zmq_msg_get.txt
doc/zmq_msg_get.txt
+1
-1
zmq_msg_more.txt
doc/zmq_msg_more.txt
+4
-2
zmq_recv.txt
doc/zmq_recv.txt
+0
-2
zmq_recvmsg.txt
doc/zmq_recvmsg.txt
+0
-1
zmq_send.txt
doc/zmq_send.txt
+0
-2
zmq_sendmsg.txt
doc/zmq_sendmsg.txt
+0
-2
zmq_socket_monitor.txt
doc/zmq_socket_monitor.txt
+3
-4
stream_engine.cpp
src/stream_engine.cpp
+5
-6
xpub.cpp
src/xpub.cpp
+8
-9
xsub.cpp
src/xsub.cpp
+11
-9
test_connect_delay.cpp
tests/test_connect_delay.cpp
+1
-1
No files found.
doc/zmq_msg_get.txt
View file @
7d475add
...
...
@@ -45,7 +45,7 @@ while (true) {
int rc = zmq_msg_init (&frame);
assert (rc == 0);
// Block until a message is available to be received from socket
rc = zmq_
recvmsg
(socket, &frame, 0);
rc = zmq_
msg_recv
(socket, &frame, 0);
assert (rc != -1);
if (zmq_msg_get (&frame, ZMQ_MORE))
fprintf (stderr, "more\n");
...
...
doc/zmq_msg_more.txt
View file @
7d475add
...
...
@@ -15,7 +15,9 @@ SYNOPSIS
DESCRIPTION
-----------
The _zmq_msg_more()_ function indicates whether this is part of a multi-part
message, and there are further parts to receive.
message, and there are further parts to receive. This method can safely be
called after _zmq_msg_close()_. This method is identical to _zmq_msg_get()_
with an argument of ZMQ_MORE.
RETURN VALUE
...
...
@@ -35,7 +37,7 @@ while (true) {
int rc = zmq_msg_init (&part);
assert (rc == 0);
// Block until a message is available to be received from socket
rc = zmq_
recvmsg
(socket, &part, 0);
rc = zmq_
msg_recv
(socket, &part, 0);
assert (rc != -1);
if (zmq_msg_more (&part))
fprintf (stderr, "more\n");
...
...
doc/zmq_recv.txt
View file @
7d475add
...
...
@@ -78,9 +78,7 @@ assert (nbytes != -1);
SEE ALSO
--------
linkzmq:zmq_recvmsg[3]
linkzmq:zmq_send[3]
linkzmq:zmq_sendmsg[3]
linkzmq:zmq_getsockopt[3]
linkzmq:zmq_socket[7]
linkzmq:zmq[7]
...
...
doc/zmq_recvmsg.txt
View file @
7d475add
...
...
@@ -110,7 +110,6 @@ SEE ALSO
--------
linkzmq:zmq_recv[3]
linkzmq:zmq_send[3]
linkzmq:zmq_sendmsg[3]
linkzmq:zmq_getsockopt[3]
linkzmq:zmq_socket[7]
linkzmq:zmq[7]
...
...
doc/zmq_send.txt
View file @
7d475add
...
...
@@ -87,9 +87,7 @@ assert (rc == 2);
SEE ALSO
--------
linkzmq:zmq_sendmsg[3]
linkzmq:zmq_recv[3]
linkzmq:zmq_recvmsg[3]
linkzmq:zmq_socket[7]
linkzmq:zmq[7]
...
...
doc/zmq_sendmsg.txt
View file @
7d475add
...
...
@@ -106,8 +106,6 @@ rc = zmq_sendmsg (socket, &part3, 0);
SEE ALSO
--------
linkzmq:zmq_recv[3]
linkzmq:zmq_recv[3]
linkzmq:zmq_recvmsg[3]
linkzmq:zmq_socket[7]
linkzmq:zmq[7]
...
...
doc/zmq_socket_monitor.txt
View file @
7d475add
...
...
@@ -37,7 +37,7 @@ static void *req_socket_monitor (void *ctx)
while (true) {
zmq_msg_t msg;
zmq_msg_init (&msg);
rc = zmq_
recvmsg
(s, &msg, 0);
rc = zmq_
msg_recv
(s, &msg, 0);
if (rc == -1 && zmq_errno() == ETERM) break;
assert (rc != -1);
memcpy (&event, zmq_msg_data (&msg), sizeof (event));
...
...
@@ -217,7 +217,7 @@ static void *rep_socket_monitor (void *ctx)
while (true) {
zmq_msg_t msg;
zmq_msg_init (&msg);
rc = zmq_
recvmsg
(s, &msg, 0);
rc = zmq_
msg_recv
(s, &msg, 0);
if (rc == -1 && zmq_errno() == ETERM) break;
assert (rc != -1);
memcpy (&event, zmq_msg_data (&msg), sizeof (event));
...
...
@@ -285,4 +285,4 @@ linkzmq:zmq[7]
AUTHORS
-------
This 0MQ manual page was written by Lourens Naudé <lourens@methodmissing.com>
\ No newline at end of file
This 0MQ manual page was written by Lourens Naudé <lourens@methodmissing.com>
src/stream_engine.cpp
View file @
7d475add
...
...
@@ -194,7 +194,7 @@ void zmq::stream_engine_t::terminate ()
void
zmq
::
stream_engine_t
::
in_event
()
{
// If still handshaking, receive and prcess the greeting message.
// If still handshaking, receive and pr
o
cess the greeting message.
if
(
unlikely
(
handshaking
))
if
(
!
handshake
())
return
;
...
...
@@ -390,9 +390,8 @@ bool zmq::stream_engine_t::handshake ()
// Position of the version field in the greeting.
const
size_t
version_pos
=
10
;
// Is the peer using the unversioned protocol?
// If so, we send and receive rests of identity
// messages.
// Is the peer using ZMTP/1.0 with no version number?
// If so, we send and receive rests of identity messages
if
(
greeting
[
0
]
!=
0xff
||
!
(
greeting
[
9
]
&
0x01
))
{
encoder
=
new
(
std
::
nothrow
)
encoder_t
(
out_batch_size
);
alloc_assert
(
encoder
);
...
...
@@ -417,8 +416,8 @@ bool zmq::stream_engine_t::handshake ()
insize
=
greeting_bytes_read
;
// To allow for interoperability with peers that do not forward
// their subscriptions, we inject a phony subsription
// message into the incom
m
ing message stream. To put this
// their subscriptions, we inject a phony subs
c
ription
// message into the incoming message stream. To put this
// message right after the identity message, we temporarily
// divert the message stream from session to ourselves.
if
(
options
.
type
==
ZMQ_PUB
||
options
.
type
==
ZMQ_XPUB
)
...
...
src/xpub.cpp
View file @
7d475add
...
...
@@ -74,9 +74,9 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
if
(
options
.
type
==
ZMQ_XPUB
&&
(
unique
||
(
*
data
&&
verbose
)))
pending
.
push_back
(
blob_t
(
data
,
size
));
}
else
/*process message unrelated to sub/unsub*/
{
else
// Process user message coming upstream from xsub socket
pending
.
push_back
(
blob_t
(
data
,
size
));
}
sub
.
close
();
}
...
...
@@ -177,13 +177,12 @@ void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
xpub_t
*
self
=
(
xpub_t
*
)
arg_
;
if
(
self
->
options
.
type
!=
ZMQ_PUB
)
{
// Place the unsubscription to the queue of pending (un)sunscriptions
// to be retrived by the user later on.
blob_t
unsub
(
size_
+
1
,
0
);
unsub
[
0
]
=
0
;
memcpy
(
&
unsub
[
1
],
data_
,
size_
);
self
->
pending
.
push_back
(
unsub
);
// Place the unsubscription to the queue of pending (un)sunscriptions
// to be retrived by the user later on.
blob_t
unsub
(
size_
+
1
,
0
);
unsub
[
0
]
=
0
;
memcpy
(
&
unsub
[
1
],
data_
,
size_
);
self
->
pending
.
push_back
(
unsub
);
}
}
...
...
src/xsub.cpp
View file @
7d475add
...
...
@@ -48,7 +48,7 @@ zmq::xsub_t::~xsub_t ()
void
zmq
::
xsub_t
::
xattach_pipe
(
pipe_t
*
pipe_
,
bool
icanhasall_
)
{
// icanhasall_ is unused
(
void
)
icanhasall_
;
(
void
)
icanhasall_
;
zmq_assert
(
pipe_
);
fq
.
attach
(
pipe_
);
...
...
@@ -87,22 +87,24 @@ int zmq::xsub_t::xsend (msg_t *msg_)
size_t
size
=
msg_
->
size
();
unsigned
char
*
data
=
(
unsigned
char
*
)
msg_
->
data
();
// Process the subscription.
if
(
*
data
==
1
)
{
// this used to filter out duplicate subscriptions,
// however this is alread done on the XPUB side and
// doing it here as well breaks ZMQ_XPUB_VERBOSE
// when there are forwarding devices involved
// Process subscribe message
// This used to filter out duplicate subscriptions,
// however this is alread done on the XPUB side and
// doing it here as well breaks ZMQ_XPUB_VERBOSE
// when there are forwarding devices involved.
subscriptions
.
add
(
data
+
1
,
size
-
1
);
return
dist
.
send_to_all
(
msg_
);
}
else
if
(
*
data
==
0
)
{
else
if
(
*
data
==
0
)
{
// Process unsubscribe message
if
(
subscriptions
.
rm
(
data
+
1
,
size
-
1
))
return
dist
.
send_to_all
(
msg_
);
}
else
/*upstream message unrelated to sub/unsub*/
{
else
// User message sent upstream to XPUB socket
return
dist
.
send_to_all
(
msg_
);
}
int
rc
=
msg_
->
close
();
errno_assert
(
rc
==
0
);
...
...
tests/test_connect_delay.cpp
View file @
7d475add
...
...
@@ -53,7 +53,7 @@ int main (void)
val
=
0
;
rc
=
zmq_setsockopt
(
to
,
ZMQ_LINGER
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
rc
=
zmq_bind
(
to
,
"tcp://*:
5
555"
);
rc
=
zmq_bind
(
to
,
"tcp://*:
6
555"
);
assert
(
rc
==
0
);
// Create a socket pushing to two endpoints - only 1 message should arrive.
...
...
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