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
3cb84b5c
Commit
3cb84b5c
authored
Aug 27, 2010
by
Jon Dyte
Committed by
Martin Sustrik
Aug 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forwarder and streamer devices handle multi-part messages correctly
parent
43f2c6ff
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
13 deletions
+36
-13
forwarder.cpp
src/forwarder.cpp
+14
-3
queue.cpp
src/queue.cpp
+8
-7
streamer.cpp
src/streamer.cpp
+14
-3
No files found.
src/forwarder.cpp
View file @
3cb84b5c
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "forwarder.hpp"
#include "forwarder.hpp"
#include "socket_base.hpp"
#include "socket_base.hpp"
#include "likely.hpp"
#include "err.hpp"
#include "err.hpp"
int
zmq
::
forwarder
(
socket_base_t
*
insocket_
,
socket_base_t
*
outsocket_
)
int
zmq
::
forwarder
(
socket_base_t
*
insocket_
,
socket_base_t
*
outsocket_
)
...
@@ -29,16 +30,26 @@ int zmq::forwarder (socket_base_t *insocket_, socket_base_t *outsocket_)
...
@@ -29,16 +30,26 @@ int zmq::forwarder (socket_base_t *insocket_, socket_base_t *outsocket_)
int
rc
=
zmq_msg_init
(
&
msg
);
int
rc
=
zmq_msg_init
(
&
msg
);
errno_assert
(
rc
==
0
);
errno_assert
(
rc
==
0
);
int64_t
more
;
size_t
more_sz
=
sizeof
(
more
);
while
(
true
)
{
while
(
true
)
{
rc
=
insocket_
->
recv
(
&
msg
,
0
);
rc
=
insocket_
->
recv
(
&
msg
,
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
}
rc
=
insocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
more_sz
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
}
}
rc
=
outsocket_
->
send
(
&
msg
,
0
);
rc
=
outsocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
...
src/queue.cpp
View file @
3cb84b5c
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "queue.hpp"
#include "queue.hpp"
#include "socket_base.hpp"
#include "socket_base.hpp"
#include "likely.hpp"
#include "err.hpp"
#include "err.hpp"
int
zmq
::
queue
(
class
socket_base_t
*
insocket_
,
int
zmq
::
queue
(
class
socket_base_t
*
insocket_
,
...
@@ -49,7 +50,7 @@ int zmq::queue (class socket_base_t *insocket_,
...
@@ -49,7 +50,7 @@ int zmq::queue (class socket_base_t *insocket_,
// Wait while there are either requests or replies to process.
// Wait while there are either requests or replies to process.
rc
=
zmq_poll
(
&
items
[
0
],
2
,
-
1
);
rc
=
zmq_poll
(
&
items
[
0
],
2
,
-
1
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
@@ -65,7 +66,7 @@ int zmq::queue (class socket_base_t *insocket_,
...
@@ -65,7 +66,7 @@ int zmq::queue (class socket_base_t *insocket_,
while
(
true
)
{
while
(
true
)
{
rc
=
insocket_
->
recv
(
&
msg
,
0
);
rc
=
insocket_
->
recv
(
&
msg
,
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
@@ -73,14 +74,14 @@ int zmq::queue (class socket_base_t *insocket_,
...
@@ -73,14 +74,14 @@ int zmq::queue (class socket_base_t *insocket_,
moresz
=
sizeof
(
more
);
moresz
=
sizeof
(
more
);
rc
=
insocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
rc
=
insocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
}
}
rc
=
outsocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
rc
=
outsocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
@@ -96,7 +97,7 @@ int zmq::queue (class socket_base_t *insocket_,
...
@@ -96,7 +97,7 @@ int zmq::queue (class socket_base_t *insocket_,
while
(
true
)
{
while
(
true
)
{
rc
=
outsocket_
->
recv
(
&
msg
,
0
);
rc
=
outsocket_
->
recv
(
&
msg
,
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
@@ -104,14 +105,14 @@ int zmq::queue (class socket_base_t *insocket_,
...
@@ -104,14 +105,14 @@ int zmq::queue (class socket_base_t *insocket_,
moresz
=
sizeof
(
more
);
moresz
=
sizeof
(
more
);
rc
=
outsocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
rc
=
outsocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
}
}
rc
=
insocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
rc
=
insocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
...
src/streamer.cpp
View file @
3cb84b5c
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "streamer.hpp"
#include "streamer.hpp"
#include "socket_base.hpp"
#include "socket_base.hpp"
#include "likely.hpp"
#include "err.hpp"
#include "err.hpp"
int
zmq
::
streamer
(
socket_base_t
*
insocket_
,
socket_base_t
*
outsocket_
)
int
zmq
::
streamer
(
socket_base_t
*
insocket_
,
socket_base_t
*
outsocket_
)
...
@@ -29,16 +30,26 @@ int zmq::streamer (socket_base_t *insocket_, socket_base_t *outsocket_)
...
@@ -29,16 +30,26 @@ int zmq::streamer (socket_base_t *insocket_, socket_base_t *outsocket_)
int
rc
=
zmq_msg_init
(
&
msg
);
int
rc
=
zmq_msg_init
(
&
msg
);
errno_assert
(
rc
==
0
);
errno_assert
(
rc
==
0
);
int64_t
more
;
size_t
more_sz
=
sizeof
(
more
);
while
(
true
)
{
while
(
true
)
{
rc
=
insocket_
->
recv
(
&
msg
,
0
);
rc
=
insocket_
->
recv
(
&
msg
,
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
}
rc
=
insocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
more_sz
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
}
}
rc
=
outsocket_
->
send
(
&
msg
,
0
);
rc
=
outsocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
rc
<
0
)
{
if
(
unlikely
(
rc
<
0
)
)
{
if
(
errno
==
ETERM
)
if
(
errno
==
ETERM
)
return
-
1
;
return
-
1
;
errno_assert
(
false
);
errno_assert
(
false
);
...
...
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