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
39e2b799
Commit
39e2b799
authored
Dec 01, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #768 from Talksum/master
changing zmq_proxy_steerable to not use null terminated strings
parents
0f6e737f
ff292d62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
proxy.cpp
src/proxy.cpp
+3
-3
test_proxy.cpp
tests/test_proxy.cpp
+4
-4
No files found.
src/proxy.cpp
View file @
39e2b799
...
...
@@ -114,13 +114,13 @@ int zmq::proxy (
if
(
unlikely
(
rc
<
0
))
return
-
1
;
}
if
(
msg
.
size
()
==
6
&&
memcmp
(
msg
.
data
(),
"PAUSE"
,
6
)
==
0
)
if
(
msg
.
size
()
==
5
&&
memcmp
(
msg
.
data
(),
"PAUSE"
,
5
)
==
0
)
state
=
paused
;
else
if
(
msg
.
size
()
==
7
&&
memcmp
(
msg
.
data
(),
"RESUME"
,
7
)
==
0
)
if
(
msg
.
size
()
==
6
&&
memcmp
(
msg
.
data
(),
"RESUME"
,
6
)
==
0
)
state
=
active
;
else
if
(
msg
.
size
()
==
10
&&
memcmp
(
msg
.
data
(),
"TERMINATE"
,
10
)
==
0
)
if
(
msg
.
size
()
==
9
&&
memcmp
(
msg
.
data
(),
"TERMINATE"
,
9
)
==
0
)
state
=
terminated
;
else
{
// This is an API error, we should assert
...
...
tests/test_proxy.cpp
View file @
39e2b799
...
...
@@ -87,7 +87,7 @@ client_task (void *ctx)
if
(
items
[
1
].
revents
&
ZMQ_POLLIN
)
{
rc
=
zmq_recv
(
control
,
content
,
CONTENT_SIZE_MAX
,
0
);
if
(
is_verbose
)
printf
(
"client receive - identity = %s command = %s
\n
"
,
identity
,
content
);
if
(
memcmp
(
content
,
"TERMINATE"
,
10
)
==
0
)
{
if
(
memcmp
(
content
,
"TERMINATE"
,
9
)
==
0
)
{
run
=
false
;
break
;
}
...
...
@@ -184,7 +184,7 @@ server_worker (void *ctx)
if
(
rc
>
0
)
{
if
(
is_verbose
)
printf
(
"server_worker receives command = %s
\n
"
,
content
);
if
(
memcmp
(
content
,
"TERMINATE"
,
10
)
==
0
)
if
(
memcmp
(
content
,
"TERMINATE"
,
9
)
==
0
)
run
=
false
;
}
// The DEALER socket gives us the reply envelope and message
...
...
@@ -236,8 +236,8 @@ int main (void)
threads
[
QT_CLIENTS
]
=
zmq_threadstart
(
&
server_task
,
ctx
);
msleep
(
500
);
// Run for 500 ms then quit
rc
=
zmq_send
(
control
,
"TERMINATE"
,
10
,
0
);
assert
(
rc
==
10
);
rc
=
zmq_send
(
control
,
"TERMINATE"
,
9
,
0
);
assert
(
rc
==
9
);
rc
=
zmq_close
(
control
);
assert
(
rc
==
0
);
...
...
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