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
06402f4f
Commit
06402f4f
authored
Dec 29, 2015
by
Constantin Rack
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1687 from hintjens/master
parents
ae3b2734
2566c02a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
15 deletions
+36
-15
zmq_msg_send.txt
doc/zmq_msg_send.txt
+2
-0
zmq_send.txt
doc/zmq_send.txt
+2
-0
zmq_sendmsg.txt
doc/zmq_sendmsg.txt
+2
-0
client.cpp
src/client.cpp
+5
-0
server.cpp
src/server.cpp
+5
-2
socket_base.cpp
src/socket_base.cpp
+0
-0
zmq.cpp
src/zmq.cpp
+2
-2
test_client_server.cpp
tests/test_client_server.cpp
+18
-11
No files found.
doc/zmq_msg_send.txt
View file @
06402f4f
...
...
@@ -67,6 +67,8 @@ ERRORS
Non-blocking mode was requested and the message cannot be sent at the moment.
*ENOTSUP*::
The _zmq_msg_send()_ operation is not supported by this socket type.
*EINVAL*::
The sender tried to send multipart data, which the socket type does not allow.
*EFSM*::
The _zmq_msg_send()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
...
...
doc/zmq_send.txt
View file @
06402f4f
...
...
@@ -58,6 +58,8 @@ ERRORS
Non-blocking mode was requested and the message cannot be sent at the moment.
*ENOTSUP*::
The _zmq_send()_ operation is not supported by this socket type.
*EINVAL*::
The sender tried to send multipart data, which the socket type does not allow.
*EFSM*::
The _zmq_send()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
...
...
doc/zmq_sendmsg.txt
View file @
06402f4f
...
...
@@ -63,6 +63,8 @@ ERRORS
Non-blocking mode was requested and the message cannot be sent at the moment.
*ENOTSUP*::
The _zmq_sendmsg()_ operation is not supported by this socket type.
*EINVAL*::
The sender tried to send multipart data, which the socket type does not allow.
*EFSM*::
The _zmq_sendmsg()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
...
...
src/client.cpp
View file @
06402f4f
...
...
@@ -54,6 +54,11 @@ void zmq::client_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
int
zmq
::
client_t
::
xsend
(
msg_t
*
msg_
)
{
// CLIENT sockets do not allow multipart data (ZMQ_SNDMORE)
if
(
msg_
->
flags
()
&
msg_t
::
more
)
{
errno
=
EINVAL
;
return
-
1
;
}
return
lb
.
sendpipe
(
msg_
,
NULL
);
}
...
...
src/server.cpp
View file @
06402f4f
...
...
@@ -93,6 +93,11 @@ void zmq::server_t::xwrite_activated (pipe_t *pipe_)
int
zmq
::
server_t
::
xsend
(
msg_t
*
msg_
)
{
// SERVER sockets do not allow multipart data (ZMQ_SNDMORE)
if
(
msg_
->
flags
()
&
msg_t
::
more
)
{
errno
=
EINVAL
;
return
-
1
;
}
// Find the pipe associated with the routing stored in the message.
uint32_t
routing_id
=
msg_
->
get_routing_id
();
outpipes_t
::
iterator
it
=
outpipes
.
find
(
routing_id
);
...
...
@@ -108,7 +113,6 @@ int zmq::server_t::xsend (msg_t *msg_)
errno
=
EHOSTUNREACH
;
return
-
1
;
}
bool
ok
=
it
->
second
.
pipe
->
write
(
msg_
);
if
(
unlikely
(
!
ok
))
{
// Message failed to send - we must close it ourselves.
...
...
@@ -118,7 +122,6 @@ int zmq::server_t::xsend (msg_t *msg_)
else
it
->
second
.
pipe
->
flush
();
// Detach the message from the data buffer.
int
rc
=
msg_
->
init
();
errno_assert
(
rc
==
0
);
...
...
src/socket_base.cpp
View file @
06402f4f
This diff is collapsed.
Click to expand it.
src/zmq.cpp
View file @
06402f4f
...
...
@@ -347,7 +347,7 @@ static int
s_sendmsg
(
zmq
::
socket_base_t
*
s_
,
zmq_msg_t
*
msg_
,
int
flags_
)
{
int
sz
=
(
int
)
zmq_msg_size
(
msg_
);
int
rc
=
s_
->
send
((
zmq
::
msg_t
*
)
msg_
,
flags_
);
int
rc
=
s_
->
send
((
zmq
::
msg_t
*
)
msg_
,
flags_
);
if
(
unlikely
(
rc
<
0
))
return
-
1
;
return
sz
;
...
...
@@ -393,7 +393,7 @@ int zmq_send_const (void *s_, const void *buf_, size_t len_, int flags_)
return
-
1
;
}
zmq_msg_t
msg
;
int
rc
=
zmq_msg_init_data
(
&
msg
,
(
void
*
)
buf_
,
len_
,
NULL
,
NULL
);
int
rc
=
zmq_msg_init_data
(
&
msg
,
(
void
*
)
buf_
,
len_
,
NULL
,
NULL
);
if
(
rc
!=
0
)
return
-
1
;
...
...
tests/test_client_server.cpp
View file @
06402f4f
...
...
@@ -31,7 +31,7 @@
int
main
(
void
)
{
setup_test_environment
();
setup_test_environment
();
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
...
...
@@ -51,36 +51,43 @@ int main (void)
char
*
data
=
(
char
*
)
zmq_msg_data
(
&
msg
);
data
[
0
]
=
1
;
rc
=
zmq_msg_send
(
&
msg
,
client
,
0
);
rc
=
zmq_msg_send
(
&
msg
,
client
,
ZMQ_SNDMORE
);
assert
(
rc
==
-
1
);
rc
=
zmq_msg_send
(
&
msg
,
client
,
0
);
assert
(
rc
==
1
);
rc
=
zmq_msg_init
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_msg_recv
(
&
msg
,
server
,
0
);
assert
(
rc
==
1
);
assert
(
rc
==
1
);
uint32_t
routing_id
=
zmq_msg_routing_id
(
&
msg
);
assert
(
routing_id
!=
0
);
rc
=
zmq_msg_close
(
&
msg
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_msg_init_size
(
&
msg
,
1
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
data
=
(
char
*
)
zmq_msg_data
(
&
msg
);
data
=
(
char
*
)
zmq_msg_data
(
&
msg
);
data
[
0
]
=
2
;
rc
=
zmq_msg_set_routing_id
(
&
msg
,
routing_id
);
assert
(
rc
==
0
);
rc
=
zmq_msg_set_routing_id
(
&
msg
,
routing_id
);
assert
(
rc
==
0
);
rc
=
zmq_msg_send
(
&
msg
,
server
,
ZMQ_SNDMORE
);
assert
(
rc
==
-
1
);
rc
=
zmq_msg_send
(
&
msg
,
server
,
0
);
rc
=
zmq_msg_send
(
&
msg
,
server
,
0
);
assert
(
rc
==
1
);
rc
=
zmq_msg_recv
(
&
msg
,
client
,
0
);
rc
=
zmq_msg_recv
(
&
msg
,
client
,
0
);
assert
(
rc
==
1
);
rc
=
zmq_msg_close
(
&
msg
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
server
);
...
...
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