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
f0a34e0f
Commit
f0a34e0f
authored
May 02, 2016
by
Luca Boccassi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_poller/use_fd_ipc/tcp use draft API
Solution: only use ZMQ_SERVER/CLIENT if the defines are available.
parent
c293618a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
test_poller.cpp
tests/test_poller.cpp
+6
-0
test_use_fd_ipc.cpp
tests/test_use_fd_ipc.cpp
+2
-0
test_use_fd_tcp.cpp
tests/test_use_fd_tcp.cpp
+2
-0
No files found.
tests/test_poller.cpp
View file @
f0a34e0f
...
...
@@ -50,6 +50,7 @@ int main (void)
void
*
bowl
=
zmq_socket
(
ctx
,
ZMQ_PULL
);
assert
(
bowl
);
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
void
*
server
=
zmq_socket
(
ctx
,
ZMQ_SERVER
);
assert
(
server
);
rc
=
zmq_bind
(
server
,
"tcp://127.0.0.1:55557"
);
...
...
@@ -57,6 +58,7 @@ int main (void)
void
*
client
=
zmq_socket
(
ctx
,
ZMQ_CLIENT
);
assert
(
client
);
#endif
// Set up poller
void
*
poller
=
zmq_poller_new
();
...
...
@@ -116,6 +118,7 @@ int main (void)
assert
(
event
.
user_data
==
bowl
);
zmq_poller_remove_fd
(
poller
,
fd
);
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
// Polling on thread safe sockets
rc
=
zmq_poller_add
(
poller
,
server
,
NULL
,
ZMQ_POLLIN
);
assert
(
rc
==
0
);
...
...
@@ -138,6 +141,7 @@ int main (void)
assert
(
event
.
socket
==
server
);
assert
(
event
.
user_data
==
NULL
);
assert
(
event
.
events
==
ZMQ_POLLOUT
);
#endif
// Destory poller, sockets and ctx
rc
=
zmq_poller_destroy
(
&
poller
);
...
...
@@ -148,10 +152,12 @@ int main (void)
assert
(
rc
==
0
);
rc
=
zmq_close
(
bowl
);
assert
(
rc
==
0
);
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
rc
=
zmq_close
(
server
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
client
);
assert
(
rc
==
0
);
#endif
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
...
...
tests/test_use_fd_ipc.cpp
View file @
f0a34e0f
...
...
@@ -124,6 +124,7 @@ void test_pair ()
void
test_client_server
()
{
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
...
...
@@ -200,6 +201,7 @@ void test_client_server ()
rc
=
unlink
(
"/tmp/tester"
);
assert
(
rc
==
0
);
#endif
}
int
main
(
void
)
...
...
tests/test_use_fd_tcp.cpp
View file @
f0a34e0f
...
...
@@ -130,6 +130,7 @@ void test_pair ()
void
test_client_server
()
{
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
...
...
@@ -203,6 +204,7 @@ void test_client_server ()
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
#endif
}
int
main
(
void
)
...
...
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