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
00cf3ceb
Commit
00cf3ceb
authored
Apr 11, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi-part message functionality available via ZMQ_SNDMORE and ZMQ_RCVMORE
parent
6fea4225
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
5 deletions
+28
-5
zmq.h
include/zmq.h
+3
-0
socket_base.cpp
src/socket_base.cpp
+22
-5
socket_base.hpp
src/socket_base.hpp
+3
-0
No files found.
include/zmq.h
View file @
00cf3ceb
...
...
@@ -179,8 +179,11 @@ ZMQ_EXPORT int zmq_term (void *context);
#define ZMQ_MCAST_LOOP 10
#define ZMQ_SNDBUF 11
#define ZMQ_RCVBUF 12
#define ZMQ_RCVMORE 13
#define ZMQ_NOBLOCK 1
#define ZMQ_SNDMORE 2
// Obsolete:
#define ZMQ_MORE 2
ZMQ_EXPORT
void
*
zmq_socket
(
void
*
context
,
int
type
);
...
...
src/socket_base.cpp
View file @
00cf3ceb
...
...
@@ -42,6 +42,7 @@ zmq::socket_base_t::socket_base_t (app_thread_t *parent_) :
object_t
(
parent_
),
pending_term_acks
(
0
),
ticks
(
0
),
rcvmore
(
false
),
app_thread
(
parent_
),
shutting_down
(
false
),
sent_seqnum
(
0
),
...
...
@@ -70,7 +71,16 @@ int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
int
zmq
::
socket_base_t
::
getsockopt
(
int
option_
,
void
*
optval_
,
size_t
*
optvallen_
)
{
// At the moment there are no socket-type-specific overloads of getsockopt.
if
(
option_
==
ZMQ_RCVMORE
)
{
if
(
*
optvallen_
<
sizeof
(
int64_t
))
{
errno
=
EINVAL
;
return
-
1
;
}
*
((
int64_t
*
)
optval_
)
=
rcvmore
?
1
:
0
;
*
optvallen_
=
sizeof
(
int64_t
);
return
0
;
}
return
options
.
getsockopt
(
option_
,
optval_
,
optvallen_
);
}
...
...
@@ -318,9 +328,8 @@ int zmq::socket_base_t::connect (const char *addr_)
int
zmq
::
socket_base_t
::
send
(
::
zmq_msg_t
*
msg_
,
int
flags_
)
{
// ZMQ_MORE is actually a message flag, not a real send-flag
// such as ZMQ_NOBLOCK. At this point we impose it on the message.
if
(
flags_
&
ZMQ_MORE
)
// At this point we impose the MORE flag on the message.
if
(
flags_
&
ZMQ_SNDMORE
)
msg_
->
flags
|=
ZMQ_MSG_MORE
;
// Process pending commands, if any.
...
...
@@ -367,8 +376,12 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
}
// If we have the message, return immediately.
if
(
rc
==
0
)
if
(
rc
==
0
)
{
rcvmore
=
msg_
->
flags
&
ZMQ_MSG_MORE
;
if
(
rcvmore
)
msg_
->
flags
&=
~
ZMQ_MSG_MORE
;
return
0
;
}
// If we don't have the message, restore the original cause of the problem.
errno
=
err
;
...
...
@@ -393,6 +406,10 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
rc
=
xrecv
(
msg_
,
flags_
);
ticks
=
0
;
}
rcvmore
=
msg_
->
flags
&
ZMQ_MSG_MORE
;
if
(
rcvmore
)
msg_
->
flags
&=
~
ZMQ_MSG_MORE
;
return
0
;
}
...
...
src/socket_base.hpp
View file @
00cf3ceb
...
...
@@ -141,6 +141,9 @@ namespace zmq
// Number of messages received since last command processing.
int
ticks
;
// If true there's a half-read message in the socket.
bool
rcvmore
;
// Application thread the socket lives in.
class
app_thread_t
*
app_thread
;
...
...
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