Commit Graph

553 Commits

Author SHA1 Message Date
Pieter Hintjens
62c66ae7f7 Problem: test_large_msg kills my system temporarily
And I'm on a reasonably sized laptop. I think allocating INT_MAX
memory is dangerous in a test case.

Solution: expose this as a context option. I've used ZMQ_MAX_MSGSZ
and documented it and implemented the API. However I don't know how
to get the parent context for a socket, so the code in zmq.cpp is
still unfinished.
2016-02-09 10:55:09 +01:00
Luca Boccassi
edc4ee03e8 Problem: ZMQ_USEFD does not follow conventions
Solution: rename socket option (and variables and files) from usefd
to use_fd.
2016-02-09 09:36:14 +00:00
Luca Boccassi
c158178798 Problem: ZMQ_PRE_ALLOCATED_FD is too long
Solution: rename socket option (and variables and files) from
pre_allocated_fd to usefd.
2016-02-08 22:46:34 +00:00
Pieter Hintjens
a1f51b695f Problem: unclear rules for passing null arguments
Solution: be more explicit in the code, and in the zmq_recv man
page (which is the most unobvious case). Assert if length is not
zero and buffer is nonetheless null.
2016-02-06 14:13:13 +01:00
Pieter Hintjens
c8318912f5 Problem: test case is using internal API
It is poor style for test cases to use the internal API (i.e.
libzmq classes or header files), as this code serves the purpose
of teaching developers how to use the library (it doesn't do this
very well, it's an ambition).

Also, including headers in src/ creates problems when compiling.

Solution: remove use of src/macros.hpp.
2016-02-06 14:12:43 +01:00
Michael
7270d4de65 windows.hpp needs to be included before zmq.h
windows.hpp must be included first due to increases _WIN32_WINNT version
2016-02-06 23:31:56 +11:00
Michael
d06314df84 added windows includes as well as unix includes
added conditional includes for unix / windows
2016-02-06 23:19:10 +11:00
Michael
75bea4bc13 update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:03:12 +11:00
Michael
05b5633b8d update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:01:26 +11:00
Michael
596fd2408a added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:58 +11:00
Michael
b98b1495af added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:13 +11:00
Michael
595181d301 added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:58:38 +11:00
Luca Boccassi
84ad4bf0ff Problem: cannot use new pre-allocated FD with TCP
Solution: parse the value set by the ZMQ_PRE_ALLOCATED_FD sockopt
when creating a new TCP socket and use it if valid.
Add new tests/test_pre_allocated_fd_tcp.cpp unit test.
2016-02-04 16:57:26 +00:00
Luca Boccassi
9b885b7c00 Problem: cannot use new pre-allocated FD with IPC
Solution: parse the value set by the ZMQ_PRE_ALLOCATED_FD sockopt
when creating a new IPC socket and use it if valid.
Add new tests/test_pre_allocated_fd_ipc.cpp unit test.
2016-02-04 16:57:26 +00:00
Luca Boccassi
4bcbb3055e Problem: cannot use pre-allocated FDs. Fixes #777
Solution: add new [set|get]sockopt ZMQ_PRE_ALLOCATED_FD to allow
users to let ZMQ use a pre-allocated file descriptor instead of
allocating a new one. Update [set|get]sockopt documentation and
test accordingly.

The main use case for this feature is a socket-activated systemd
service. For more information about this feature see:
http://0pointer.de/blog/projects/socket-activation.html
2016-02-04 16:57:26 +00:00
Pieter Hintjens
44c6b0484e Revert "Revert "Problem: deprecated use and reference of zmq_term"" 2016-02-01 23:00:06 +01:00
Pieter Hintjens
1708bfefb7 Revert "Problem: deprecated use and reference of zmq_term" 2016-02-01 22:41:51 +01:00
Constantin Rack
0d171563d0 Problem: tests use deprecated zmq_term function
Solution: replace all occurrences with `zmq_ctx_term`
2016-02-01 21:40:24 +01:00
Constantin Rack
7da3ee138e Problem: deprecated zmq_utils.h is still included
Solution: remove all remaining references to `zmq_utils.h`
2016-02-01 11:34:36 +01:00
somdoron
389e853c6d Fix compilation errors on windows 2016-01-30 13:29:41 +02:00
Doron Somech
add4e7675f Merge pull request #1744 from jcfr/fix-gcc-warnings
Fix unused-parameter/unused-but-set-variable/missing-field-initializers warnings
2016-01-30 09:08:09 +01:00
Jean-Christophe Fillion-Robin
46b02338e3 Style: Fix -Wunused-but-set-variable in test_stream_exceeds_buffer.cpp
This commit addresses the following warnings reported on gcc 5.2.1. In
the future, this will help reduce the "noise" and help catch warnings
revealing a serious problem.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
/path/to/libzmq/tests/test_stream_exceeds_buffer.cpp: In function ‘int main()’:
/path/to/libzmq/tests/test_stream_exceeds_buffer.cpp:19:9: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
     int rc = setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
         ^
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:56:03 -05:00
Jean-Christophe Fillion-Robin
f329252dcb Style: Fix unused parameter compilation warnings
This commit addresses the following warnings reported on gcc 5.2.1. In
the future, this will help reduce the "noise" and help catch warnings
revealing a serious problem.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
/path/to/libzmq/src/options.cpp:1048:36: warning: unused parameter ‘option_’ [-Wunused-parameter]
 bool zmq::options_t::is_valid (int option_) const
                                    ^

/path/to/libzmq/src/plain_client.cpp:146:30: warning: unused parameter ‘cmd_data’ [-Wunused-parameter]
         const unsigned char *cmd_data, size_t data_size)
                              ^

/path/to/libzmq/src/plain_client.cpp:146:30: warning: unused parameter ‘cmd_data’ [-Wunused-parameter]
         const unsigned char *cmd_data, size_t data_size)
                              ^

/path/to/libzmq/src/socket_base.cpp:1445:44: warning: unused parameter ‘group_’ [-Wunused-parameter]
 int zmq::socket_base_t::xjoin (const char *group_)
                                            ^
/path/to/libzmq/src/socket_base.cpp:1451:45: warning: unused parameter ‘group_’ [-Wunused-parameter]
 int zmq::socket_base_t::xleave (const char *group_)
                                             ^

/path/to/libzmq/src/radio.cpp:145:33: warning: unused parameter ‘msg_’ [-Wunused-parameter]
 int zmq::radio_t::xrecv (msg_t *msg_)
                                 ^
/path/to/libzmq/src/dish.cpp:164:32: warning: unused parameter ‘msg_’ [-Wunused-parameter]
 int zmq::dish_t::xsend (msg_t *msg_)
                                ^

/path/to/libzmq/tests/test_msg_ffn.cpp:32:16: warning: unused parameter ‘data’ [-Wunused-parameter]
 void ffn(void *data, void *hint) {
                ^

/path/to/libzmq/tests/test_timers.cpp:50:19: warning: unused parameter ‘timer_id’ [-Wunused-parameter]
 void handler (int timer_id, void* arg)
                   ^
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:56:03 -05:00
Jean-Christophe Fillion-Robin
05e48cc6a9 ctest: Add missing test_udp and test_large_msg
This commit fixes the author warnings reported below. These tests
have originally been introduced in zeromq/libzmq@5ebfd17 and
zeromq/libzmq@5fe75f0.

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
CMake Warning (dev) at tests/CMakeLists.txt:133 (message):
  Test 'test_udp' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:133 (message):
  Test 'test_large_msg' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
2016-01-30 02:10:01 -05:00
somdoron
5ebfd1728f make udp support for radio-dish 2016-01-29 21:17:11 +02:00
somdoron
1960b4e8a9 Filtering messages on dish side 2016-01-29 10:53:47 +02:00
somdoron
5054f2eb61 radio-dish is sending the group as first frame 2016-01-29 10:53:47 +02:00
somdoron
68675e23d9 adds group to zmq_msg 2016-01-29 10:53:42 +02:00
somdoron
dc945998a4 missing virtual modifier or session_base 2016-01-28 18:31:05 +02:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
somdoron
b8425a25cf radio-dish pattern 2016-01-27 18:22:48 +02:00
Constantin Rack
5c9bd5f0cb Problem: SIZE_MAX is not defined in all stdint.h includes
Solution: remove debug printf line completely
2016-01-20 19:30:21 +01:00
Constantin Rack
b7d42a4c4b Problem: SIZE_MAX is not defined
Solution: include stdint.h
2016-01-20 19:18:00 +01:00
Min RK
5fe75f0e43 truncate rc to INT_MAX
to avoid overflow for large messages

send/recv still succeed for large messages,
but `zmq_msg_size` must be used to get the true size.
2016-01-20 13:43:51 +01:00
somdoron
669c5697c2 fixing a bug: client over inproc receives msg with routing id set 2016-01-19 20:18:04 +02:00
Anonymous Maarten
be36423bc2 Problem: On Windows CI, the included file Windows.hpp could not be
found.
Solution: Include the source directory

Problem: _sleep is a library function of Windows.
Solution: use sleep_
2016-01-14 02:53:24 +01:00
Frederic Tregon
9bdb60577c Test for issue #1690 (ZMQ_REQ_RELAXED)
Current ZMQ_REQ_RELAXED test improvement to check that pipes are not closed
after executing two send() in a row with no recv() in between.
2016-01-03 15:28:07 +01:00
Pieter Hintjens
2566c02a9e Problem: CLIENT and SERVER don't check SNDMORE
These sockets don't handle multipart data, so if callers send it,
they drop frames, and things break silently.

Solution: if the caller tries to use ZMQ_SNDMORE, return -1 and
set errno to EINVAL.
2015-12-29 17:00:06 +01:00
Pieter Hintjens
7893a6ac26 Problem: zmq poller API is not CLASS conformant
Solution: change zmq_poller_close(p) to zmq_poller_destroy(&p)
2015-12-21 11:01:16 +01:00
Pieter Hintjens
f8b9ca5f42 Problem: zmq timers API is not CLASS conformant
If we're going to add CLASS-like APIs we should use the proper
syntax; specifically 'destroy' instead of 'close', which is a
hangover from the 'ZeroMQ is like sockets' model we're slowly
moving away from.

Solution: change zmq_timers_close(p) to zmq_timers_destroy(&p)
2015-12-21 10:56:37 +01:00
somdoron
aadaf99011 add timers API to libzmq 2015-12-18 12:23:22 +02:00
Ilya Kulakov
68b13fbddb Add the VMCI transport.
VMCI transport allows fast communication between the Host
and a virtual machine, between virtual machines on the same host,
and within a virtual machine (like IPC).

It requires VMware to be installed on the host and Guest Additions
to be installed on a guest.
2015-12-08 13:16:09 +06:00
Fedor Sheremetyev
234018d749 Add test demostrating that HWM applies to messages that have been already consumed. 2015-11-24 17:33:19 +00:00
Constantin Rack
5ba328d7f3 Problem: there is no test for setsockopt ZMQ_TCP_SEND/RECV_BUFFER
Solution: add test case
2015-11-13 10:44:00 +01:00
Anonymous Maarten
9930f1fc20 CTest: add missing tests + check for unknown tests 2015-10-24 00:17:52 +02:00
Anonymous Maarten
55ca9c5654 CMake: use libsodium if available, else use tweet_nacl 2015-10-23 04:06:57 +02:00
somdoron
da2bc60abe Removing zmq_pollfd as it is replaced by zmq_poller 2015-10-22 11:52:24 +03:00
somdoron
24fc0d4e89 drop the socket postfix from poller methods 2015-10-21 14:04:33 +03:00
somdoron
476ba22e0a ZMQ_Poller support more event types 2015-10-21 10:14:36 +03:00
somdoron
6501b8089f port zpoller to libzmq as zmq_poller 2015-10-18 21:07:23 +03:00
Richard Newton
3f4f3c1137 Fix windows cmake build 2015-09-14 13:21:20 +01:00
Constantin Rack
2c94bb42c5 Merge pull request #1578 from hintjens/master
Problem: drop tests on CLIENT/SERVER are misleading
2015-09-13 14:18:49 +02:00
Pieter Hintjens
50859e40b9 Problem: drop tests on CLIENT/SERVER are misleading
These sockets deal only with single part data (at present), so the
drop tests are misleading / inappropriate.

Solution: remove them.
2015-09-13 12:17:53 +02:00
Joe Eli McIlvain
fb57110b94 Merge pull request #1577 from hintjens/master
Various cleanups for CLIENT-SERVER sockets
2015-09-11 14:24:51 -07:00
Pieter Hintjens
6b00f40f74 Problem: test_client/server_drop_more are invalid
These tests connected CLIENT and SERVER to DEALER... this isn't
allowed. I changed to CLIENT-to-SERVER in both cases. The result
was aborts in client.cpp and server.cpp which cannot handle
invalid multipart data.

I removed the asserts in each of these in xsend.

Solution: fix the test cases and remove the (unwanted?) asserts
in client.cpp:xsend and server.cpp:xsend.
2015-09-11 17:07:50 -04:00
Pieter Hintjens
c2dffb9908 Problem: threadsafe test uses CLIENT-to-CLIENT
Solution: fix to use CLIENT-to-SERVER and increase number of messages
sent to 100K per thread, to better stress thread safety.
2015-09-11 17:01:27 -04:00
Pieter Hintjens
d416ffcec5 Problem: cannot build single test case in tests
This is due to the mangled include of platform.h, which was to make
CMake happy.

Solution: in CMakeLists.txt, define USING_CMAKE and then look for
platform.h in current directory if that is defined, else look in
../src/ as one would expect.
2015-09-11 16:42:26 -04:00
Pieter Hintjens
87f2dff38c Problem: zmq_msg_get_routing_id () is not consistent with API
We do not use 'get' for getters.

Solution: rename to zmq_msg_routing_id () for public API.
2015-09-11 13:15:00 -04:00
David Jelenc
64ffda90d2 Problem: Tests in Travis are failing randomly
Tests were failing, because some deque calls were causing undefined
behavior: calling front() or pop_front() on an empty deque. Such
calls are now safeguarded.
2015-09-06 01:49:50 +02:00
David Jelenc
8fd71d631d Fixed missing subscriptions on XPUB with manual subscriptions
The patch fixes the issue #1568.
2015-09-05 15:56:26 +02:00
David Jelenc
dd35e1db0f Problem: lingering subscriptions on XPUB sockets (#1566)
The patch fixes lingering subscriptions that occur upon disconnection
on XPUB sockets with option XPUB_MANUAL when used in a XPUB-XSUB
proxies.
2015-09-05 12:07:50 +02:00
Pieter Hintjens
1fdf8f78e4 Cleaned up test case 2015-09-02 09:55:19 +02:00
Richard Newton
096007c574 Fix zmq crash when calling shutdown with a pending inproc socket connect 2015-08-21 10:06:54 +01:00
Joe Eli McIlvain
61217a2686 Problem: Source files contain mixed tabs and spaces.
Solution: Convert to spaces and remove trailing whitespace in these files.
2015-08-20 07:46:34 -07:00
somdoron
4da5ff6a7d revert to original zmq_polland creating zmq_pollfd_poll for polling on pollfd 2015-08-17 18:57:47 +03:00
somdoron
d83b045347 rename poller to pollfd 2015-08-17 14:20:49 +03:00
somdoron
5bae6911af remove poller field, using fd instead 2015-08-17 11:56:23 +03:00
somdoron
1aaa893e02 add tests for polling on thread safe sockets 2015-08-16 13:57:28 +03:00
somdoron
34968771ca add an option to check if the socket is thread safe 2015-08-16 11:50:50 +03:00
Constantin Rack
effc26c695 Merge pull request #1476 from hintjens/master
Problem: lack test case for large stream messages
2015-08-12 10:03:45 +02:00
Constantin Rack
08c2a9274e Merge pull request #1514 from rikvdh/master
Merge fix for zeromq/zeromq4-1#52, getsockopt ZMQ_RCVMORE now resets all bits
2015-08-11 23:30:59 +02:00
Rik van der Heijden
5485d6e371 Check proxy return values in tests 2015-08-11 21:44:41 +02:00
Rik van der Heijden
c68e9a39bf Merge fix for zeromq/zeromq4-1#52, getsockopt ZMQ_RCVMORE now resets all bits 2015-08-11 21:37:50 +02:00
Pieter Hintjens
fd9bd1b2a5 Problem: broke Cmake build 2015-08-11 19:35:48 +02:00
Pieter Hintjens
11fba2b813 Fixed compile errors in test_stream 2015-08-11 19:34:25 +02:00
Pieter Hintjens
92c4decb69 Problem: lack test case for large stream messages
Solution: added to test_stream.cpp
2015-08-11 19:34:25 +02:00
Pieter Hintjens
a656b399cc Merge pull request #1496 from brian-peloton/macro-to-disable-test-timeout
Add a way to disable libzmq's internal test timeout.
2015-07-28 22:57:58 +02:00
Pieter Hintjens
94b6fca406 Merge pull request #1495 from brian-peloton/fix-test-flakiness
Increase sleep in test to fix flakiness under CPU load.
2015-07-28 22:57:46 +02:00
Pieter Hintjens
5dee46052d Merge pull request #1494 from brian-peloton/fix-partial-recv-in-test
Retry recv if it only returns part of a message during tests.
2015-07-28 22:57:35 +02:00
Brian Silverman
c4c5135db6 Retry recv if it only returns part of a message during tests.
Under linux 3.16.0-4-amd64, I was getting occasional test failures
before fixing this.
2015-07-28 13:48:48 -07:00
Brian Silverman
e449d7bfbd Fix test flakiness.
I'm pretty sure this is an issue with the test being too picky and not a
bug, but the behavior in this situation is not well documented.
2015-07-28 13:48:23 -07:00
Brian Silverman
f86bded783 Increase sleep in test to fix flakiness under CPU load. 2015-07-28 13:47:56 -07:00
Brian Silverman
cb0491ca18 Add a way to disable libzmq's internal test timeout.
It's nice to be able to disable libzmq's internal timeout when there's
another timeout in the test runner being used which gives nicer error
messages.
2015-07-28 13:47:19 -07:00
KIU Shueng Chuan
fd51b0e508 update test that relied on connect notifications to be disabled 2015-07-24 05:39:47 +08:00
Brian Silverman
18791f2bfb Fix several missing msg_t::close calls.
I traced memory leaks found using AddressSanitizer down to these.
2015-07-21 19:42:20 -07:00
Brian Silverman
a88524d388 Fix test_proxy hanging occasionally by setting ZMQ_LINGER to 0. 2015-07-20 19:41:23 -07:00
Jens Auer
23797120ff Fixed #1477 corruption in "zero-copy" raw_decoder for payloads larger than 8192 bytes #1477
Fixed wrong message::init arguments.
2015-07-20 22:22:13 +02:00
Dylan Cali
0f208c122d be pedantic and call zmq_close in tests 2015-06-28 22:32:15 -05:00
Dylan Cali
d14f419743 another errant comment 2015-06-28 21:29:23 -05:00
Dylan Cali
6dac5092ad fix errant comments 2015-06-28 21:27:06 -05:00
Dylan Cali
a9fd750e1c add tests for #949 2015-06-28 21:23:25 -05:00
Jonathan Reams
e9a5bc8d1e Fix units and default values for heartbeats options
Set the ZMQ_HEARTBEAT_TIMEOUT to default to the value of
ZMQ_HEARTBEAT_IVL if it's not explicitly set.
Change the units of ZMQ_HEARTBEAT_TTL to milliseconds in the API
and round down to the nearest decisecond so that all the options
are using the same units.
Make the maximum heartbeat TTL match the spec (6553 seconds)
2015-06-26 14:25:58 -04:00
Jonathan Reams
df0c7076bd Fix test_heartbeats compile in VS2013 2015-06-24 14:28:36 -04:00
Jonathan Reams
cbb3b176a6 Add ZMTP heartbeats
This commit adds ZMTP connection heartbeats described in
http://rfc.zeromq.org/spec:37/ZMTP.
2015-06-24 13:24:53 -04:00
Constantin Rack
15f9ee19cb Solution: allow brackets in tcp ipv6 address 2015-06-23 08:54:49 +02:00
Richard Newton
f696d0399c Fix tabbing 2015-06-10 16:47:23 +01:00
Richard Newton
8484e1606d Fix windows build 2015-06-10 16:43:59 +01:00
Min RK
fdb7d68056 test zmq_msg custom free-function
new allocation caused reference counters to lose track on copy
2015-06-08 15:18:53 -07:00
Min RK
f34cc24bd7 test proxy with single REP socket 2015-06-06 21:05:55 -07:00
Richard Newton
dc949624e1 Handle infinite hwms properly 2015-06-05 19:06:36 +01:00