0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-13 17:27:57 +08:00

263 Commits

Author SHA1 Message Date
Doron Somech
87c0447521 problem: zeromq connects peer before handshake is completed
Solution: delay connecting the peer pipe until the handshake is completed
(cherry picked from commit e7f0090b161ce6344f6bd35009816a925c070b09)

Conflicts:
	src/i_engine.hpp
	src/norm_engine.hpp
	src/pgm_receiver.hpp
	src/pgm_sender.hpp
	src/raw_engine.cpp
	src/session_base.cpp
	src/session_base.hpp
	src/stream_engine_base.cpp
	src/stream_engine_base.hpp
	src/udp_engine.hpp
	src/ws_engine.cpp
	src/zmtp_engine.cpp
	tests/test_mock_pub_sub.cpp
2020-08-30 15:06:47 +01:00
Pieter Hintjens
0c332648f8 Fixed wildcard IPC endpoint and added test case
Conflicts:
    .gitignore
    tests/Makefile.am
2016-06-09 15:10:53 +01:00
Jean-Christophe Fillion-Robin
d2687e75b6 Fix unused parameter and variable warnings.
Backported from zeromq/libzmq@00aeadd

It fixes the following warnings:

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
In file included from /path/to/src/mechanism.cpp:22:0:
/path/to/src/mechanism.hpp:49:36: warning: unused parameter 'msg_' [-Wunused-parameter]
         virtual int encode (msg_t *msg_) { return 0; }
                                    ^
/path/to/src/mechanism.hpp:51:36: warning: unused parameter 'msg_' [-Wunused-parameter]
         virtual int decode (msg_t *msg_) { return 0; }
                                    ^
/path/to/src/mechanism.cpp:126:51: warning: unused parameter 'name_' [-Wunused-parameter]
 int zmq::mechanism_t::property (const std::string name_,
                                                   ^
/path/to/src/mechanism.cpp:127:45: warning: unused parameter 'value_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                             ^
/path/to/src/mechanism.cpp:127:60: warning: unused parameter 'length_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                                            ^

/path/to/src/mechanism.cpp:127:60: warning: unused parameter 'length_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                                            ^

In file included from /path/to/src/pipe.cpp:28:0:
/path/to/src/ypipe_conflate.hpp: In instantiation of 'bool zmq::ypipe_conflate_t<T, N>::unwrite(T*) [with T = zmq::msg_t; int N = 256]':
/path/to/src/pipe.cpp:489:1:   required from here
/path/to/src/ypipe_conflate.hpp:73:33: warning: unused parameter 'value_' [-Wunused-parameter]
         inline bool unwrite (T *value_)
                                 ^

/path/to/src/zmq_utils.cpp:178:30: warning: unused parameter 'z85_public_key' [-Wunused-parameter]
 int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
                              ^
/path/to/src/zmq_utils.cpp:178:52: warning: unused parameter 'z85_secret_key' [-Wunused-parameter]
 int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
                                                    ^

/path/to/tests/test_hwm.cpp:205:57: warning: unused parameter 'recv_hwm' [-Wunused-parameter]
 int test_inproc_bind_and_close_first (int send_hwm, int recv_hwm)
                                                         ^
[ 69%] Linking CXX executable bin/test_connect_resolve
/path/to/tests/test_disconnect_inproc.cpp:31:14: warning: unused parameter 'argc' [-Wunused-parameter]
 int main(int argc, char** argv) {
              ^
/path/to/tests/test_disconnect_inproc.cpp:31:27: warning: unused parameter 'argv' [-Wunused-parameter]
 int main(int argc, char** argv) {
                           ^

/path/to/tests/test_stream.cpp:39:81: warning: missing initializer for member 'zmtp_greeting_t::as_server' [-Wmissing-field-initializers]
     = { { 0xFF, 0, 0, 0, 0, 0, 0, 0, 1, 0x7F }, { 3, 0 }, { 'N', 'U', 'L', 'L'} };
                                                                                 ^
/path/to/tests/test_stream.cpp:39:81: warning: missing initializer for member 'zmtp_greeting_t::filler' [-Wmissing-field-initializers]
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---

# Conflicts:
#	src/stream.cpp
#	src/stream_engine.cpp
#	tests/test_stream_disconnect_notifications.cpp
2016-01-30 04:13:39 -05:00
Richard Newton
bff7f02d15 Merge pull request #136 from bluca/fix-ci-timeout
Problem: CI may fail due to timeout. Fixes #135
2015-08-02 19:31:16 +01:00
Richard Newton
fb6a0b24f7 Merge pull request #107 from minrk/backport-721
backport stream socket empty frame fix
2015-08-02 19:23:48 +01:00
Luca Boccassi
a228da62b1 Problem: CI may fail due to timeout. Fixes #135
Solution: cherry-pick Pieter Hintjens commit a7a512ab from libzmq
repository to increase test timeouts to 250 msec.
2015-08-02 19:23:15 +01:00
Dylan Cali
8d59f91acd add tests for zeromq/libzmq#949 2015-06-28 23:25:48 -05:00
Min RK
3d6f11e56d backport stream socket empty frame fix
backport of zeromq/libzmq#721

In the discussion, it was decided to backport, but that never actually happened.

test file was renamed after the above PR, so the version from master is pulled in here.
2015-06-07 11:20:27 -07:00
Min RK
c8feda9e19 test proxy with single REP socket 2015-06-07 11:16:38 -07:00
Min RK
286c6f93ee test that proxy messages are received 2015-06-05 13:45:23 -07:00
Jason Unovitch
2ac32f8c49 Add missing newline to test_proxy_terminate.cpp to fix compiling with Clang's -Werror,-Wnewline-eof 2015-06-04 19:37:47 -04:00
Rik van der Heijden
8a9fece30a Backport zeromq/libzmq#1382: Do not send data to backend when there are no listeners (+ test) 2015-05-01 20:51:37 +02:00
Pieter Hintjens
77ef79e3b5 Problem: issue #1273, protocol downgrade attack
Solution: backport fix from libzmq master. Also backported test
cases.
2014-12-05 09:08:02 +01:00
Pieter Hintjens
73e59be321 Updated CURVE test case 2014-09-20 10:39:13 +02:00
Pieter Hintjens
d73b240880 Merged patch for #1190 2014-09-20 10:37:18 +02:00
Ewen McNeill
c06ab77c3b z/OS: signal(SIGPIPE, SIG_IGN) for tests
Updated:
   tests/testutil.hpp: Add signal(SIGPIPE, SIG_IGN) to
        setup_test_environment(), on z/OS (__MVS__)
2014-07-24 11:11:54 +12:00
Olaf Mandel
a6bd295210 Add failing test reproducing issue #1015.
There is a race condition when connect and bind on a new inproc
endpoint happen "simultaneously" in threads.  Causes the error:
  Assertion failed: ok (ctx.cpp:474)

This is a backport of libzmq:5cf74db6b
by Joe Eli McIlvain <joe.eli.mac@gmail.com>
2014-05-21 16:58:01 +02:00
Richard Newton
c7a7de12a3 Backported fix for #888 2014-02-13 14:56:09 +00:00
Pieter Hintjens
c022c048dc Fixed test_many_sockets
* failed on systems where process could not allocate 1024 sockets by default
* include path for platform.hpp was wrong; fixed it
2013-11-24 18:55:28 +01:00
Richard Newton
111c20dc22 Fix signed/unsigned comparison 2013-11-19 11:00:07 +01:00
Richard Newton
3a4896f4a3 Fix signed/unsigned comparison 2013-11-19 10:59:57 +01:00
Richard Newton
0855c28069 Reduce default maximum number of sockets by 1 so there is room for the reaper socket. 2013-11-19 10:58:34 +01:00
Bruno D. Rodrigues
f72dbb35d5 Fix socket creation above sistem limits for all 'other' OS not covered by eventfd, windows or vms; enhanced test to create sockets up to a bigger limit to really test hitting the OS limit 2013-11-19 10:55:48 +01:00
Pieter Hintjens
e0c8a112a4 Cherry picking fixes from master 2013-11-09 09:56:21 +01:00
Richard Newton
24311dee1b Add test case for many sockets
Conflicts:
	CMakeLists.txt
	tests/Makefile.am
2013-11-09 09:50:43 +01:00
Pieter Hintjens
7f3d0995cd Removed over-long pauses in tests
- used msleep (10) in most places instead of zmq_sleep (1)
- may cause failures on slower machines
- to change, modify SETTLE_TIME in testutil.h
- tested down to 1 msec on fast boxes

Conflicts:
	tests/test_connect_delay_tipc.cpp
	tests/test_proxy.cpp
	tests/test_sub_forward_tipc.cpp
	tests/test_term_endpoint_tipc.cpp
	tests/testutil.hpp
2013-11-09 09:44:17 +01:00
Richard Newton
30f470eff5 Fix test warning. 2013-11-06 20:16:03 +01:00
Richard Newton
f0b69bba28 Fix test warning. 2013-11-06 20:16:03 +01:00
MinRK
60032ef330 test zmq_msg_close after sending empty message on ROUTER_RAW 2013-11-06 20:16:03 +01:00
Pieter Hintjens
1c70e91c6f Fixed configure error on non-Linux boxes 2013-10-28 11:58:29 +01:00
Pieter Hintjens
b58055794b Fixed ref to zmq_socket_monitor 2013-10-28 11:49:23 +01:00
Pieter Hintjens
8efd7affc6 test_stream failed when response was broken into frames 2013-10-25 09:56:04 +02:00
Brandon Carpenter
80d657a2c5 Add test for abstract namespace support in ipc sockets on Linux.
See issue 567.
2013-10-05 09:20:20 +02:00
KIU Shueng Chuan
a570b18931 WinSock2.h filename should be all lowercase 2013-10-05 09:20:06 +02:00
KIU Shueng Chuan
5493d4d180 test for _MSC_VER before using MSVC specific code 2013-10-05 09:19:58 +02:00
Pieter Hintjens
a78ccf293f Disabled randomly failing part of test 2013-10-04 09:13:35 +02:00
Pieter Hintjens
a69fa9ecde Packaging for zmq_curve_keypair function
* Added new man page for this
* Added test case, in tests/test_security_curve.cpp
* Noted in zmq_utils.h that these methods are documented
2013-10-04 09:13:05 +02:00
Pieter Hintjens
b0059211d5 Added test case for issue 566
* Tests dealer-to-router connection 100 times
* This was failing in ZMQ v4.0.0 RC1
2013-09-26 14:46:35 +02:00
Pieter Hintjens
5e25b32c36 Build/test errors on OS/X with clang++ 2013-09-26 12:17:28 +02:00
Pieter Hintjens
201454e866 Move away from port 8080 which is occupied on some boxes 2013-09-20 23:17:01 +02:00
Pieter Hintjens
e0676a2b26 Renamed new socket options to be clearer
* ZMQ_REQ_STRICT was negative option (default 1) which goes against
  the standard, where defaults are zero. I renamed this to
  ZMQ_REQ_RELAXED.

* ZMQ_REQ_REQUEST_IDS felt clumsy and describes the technical solution
  rather than the problem/requirement. I changed to ZMQ_REQ_CORRELATE
  which seems more explicit.
2013-09-20 15:50:25 +02:00
Pieter Hintjens
fef4fa8fc5 Renamed test_connect_delay to test_immediate
* The ZMQ_CONNECT_DELAY option was renamed to ZMQ_IMMEDIATE
2013-09-20 15:34:55 +02:00
Pieter Hintjens
e05556075f Renamed inproc connect test (name was too long) 2013-09-19 09:36:43 +02:00
Richard Newton
de91c7362c Merge pull request #668 from mrothe/no-public-tests
tests: don't listen on public ports
2013-09-18 04:09:51 -07:00
Markus Rothe
b13230510c tests: don't listen on public ports 2013-09-18 12:58:19 +02:00
Pieter Hintjens
825052f83f Revert "makes curve keys symetric as in libcurve + factorisation"
This reverts commit bfd472f97cad5e37fa384b687a906f515600bac4.
2013-09-17 14:05:55 +02:00
Pieter Hintjens
22eb4d600b Revert "oblige the application to explicitely set the node type for PLAIN"
This reverts commit 1206f4572b4b3bb405a14cc60605b75d53b819a0.
2013-09-17 14:05:41 +02:00
Laurent Alebarde
1206f4572b oblige the application to explicitely set the node type for PLAIN 2013-09-17 12:47:21 +02:00
Laurent Alebarde
bfd472f97c makes curve keys symetric as in libcurve + factorisation 2013-09-17 12:44:14 +02:00
Pieter Hintjens
7bb2b6ae11 Fixed length of domain setting 2013-09-17 10:04:57 +02:00
Pieter Hintjens
7735ca5f8d Added test case for NULL domains 2013-09-17 09:48:32 +02:00
Pieter Hintjens
fe9815a789 Fixed random failures in test_security_plain and _curve
* ZAP handler thread was not getting time to start up
* Code now creates and binds handler socket in parent thread and
  passes the socket to the zap_handler, so this always gets the
  authentication requests.
2013-09-16 10:56:49 +02:00
Richard Newton
6f351007d4 Fix windows build 2013-09-16 09:23:47 +01:00
Laurent Alebarde
dc1f5e9f7c simplify test_security_curve.cpp with zmq_z85_encode 2013-09-16 00:06:24 +02:00
Pieter Hintjens
576e3ca5e0 Added z85 codec to ZMQ API
* Removed redundant Z85 code and include files from project
* Simplified use of headers in test cases (now they all just use testutil.hpp)
* Export zmq_z85_encode() and zmq_z85_decode() in API
* Added man pages for these two functions
2013-09-15 20:13:44 +02:00
Pieter Hintjens
193d0bb634 Fixed Z85 methods to be static and not pollute library 2013-09-15 17:30:18 +02:00
Richard Newton
b9298823b4 Set hwm on connect socket before bind has happend to just that of connects hwm. 2013-09-15 13:35:44 +01:00
Richard Newton
7841b0dd0f Support high water mark on inproc socket connect before bind. 2013-09-14 17:27:18 +01:00
Richard Newton
d5bd68b60b Merge branch 'master' of https://github.com/zeromq/libzmq into inproc_connect_before_bind 2013-09-12 21:09:30 +01:00
Richard Newton
379bcb0881 Send identities when connecting pending sockets. 2013-09-12 21:07:29 +01:00
Richard Newton
7c3496a76a Fix race condition and support multiple socket connects before bind. 2013-09-12 18:09:37 +01:00
Laurent Alebarde
6c84a54388 add exhaustive comparison in testutil bounce 2013-09-12 18:17:31 +02:00
Richard Newton
6fefa4166a Merge remote-tracking branch 'upstream/master' into inproc_connect_before_bind 2013-09-12 15:13:25 +01:00
Richard Newton
5f20d63665 First attempt at inproc connect before bind 2013-09-12 14:44:44 +01:00
Martin Hurton
168efb9739 Merge pull request #653 from mattconnolly/master
Fix preprocessor typoe
2013-09-12 05:21:25 -07:00
Pieter Hintjens
52370bff44 Removed debugging printfs 2013-09-12 12:46:23 +02:00
Matt Connolly
0f9e5f6049 Fix preprocessor typoe 2013-09-12 20:30:16 +10:00
Richard Newton
8e6b5ad17e Fix Makefile.am for test_ctx_destroy 2013-09-11 15:02:16 +01:00
Richard Newton
ccf0e61b77 Merge remote-tracking branch 'upstream/master' 2013-09-10 13:30:11 +01:00
Richard Newton
64e1c181f7 Implement non-blocking shutdown command that unblocks other threads waiting on blocking operations. 2013-09-10 13:30:00 +01:00
Martin Hurton
25c89cace1 Merge pull request #649 from hintjens/master
Fixed minor error in NULL mechanism (spec was wrong)
2013-09-09 12:12:36 -07:00
Pieter Hintjens
6725c4644f Added ZMQ_ZAP_DOMAIN socket option
* This is passed to the ZAP handler in the 'domain' field

* If not set, or empty, then NULL security does not call the ZAP handler

* This resolves the phantom ZAP request syndrome seen with sockets where
  security was never intended (e.g. in test cases)

* This means if you install a ZAP handler, it will not get any requests
  for new connections until you take some explicit action, which can be
  setting a username/password for PLAIN, a key for CURVE, or the domain
  for NULL.
2013-09-09 20:40:34 +02:00
Richard Newton
a601b3f6f4 Remove windows debug code. 2013-09-06 10:25:00 +01:00
Richard Newton
7485b09cba Fix tests on windows 2013-09-06 10:08:11 +01:00
Martin Hurton
498dc37988 Merge pull request #645 from hintjens/master
Updated libzmq to match RFCs
2013-09-06 00:54:51 -07:00
Pieter Hintjens
4c75306023 Fixed test_stream case
- was not looping to read all input from peer
- broke on OS/X specifically
2013-09-06 09:22:09 +02:00
Pieter Hintjens
9dd324aab2 z85 encoding buffer overrun 2013-09-05 15:18:42 +02:00
Pieter Hintjens
32fa426e61 Added system check at start of selftests
- tests that system can provide at least 1,000 sockets
- we could expand on this but this covers the main case of OS/X
  having a too-low default limit of 256 handles per process
2013-09-04 19:38:15 +02:00
MinRK
bb348858f1 mark test_linger as expected failure
rather than pretending it passes
2013-09-04 09:40:08 -07:00
Pieter Hintjens
6612280946 Removed temporary patch on tests/Makefile.am 2013-09-04 18:10:47 +02:00
Pieter Hintjens
28b0a5fa27 Updated libzmq to match RFC 23, 24, 25, 26
* Command names changed from null terminated to length-specified
* Command frames use the correct flag (bit 2)
* test_stream acts as test case for command frames
* Some code cleanups
2013-09-04 17:59:45 +02:00
Pieter Hintjens
1844a27c82 Removed test_raw_sock test case (replaced by test_stream) 2013-09-04 15:00:05 +02:00
Pieter Hintjens
fb67e160a1 Fixed ZAP authentication
- if ZAP server returns anything except 200, connection is closed
- all security tests now pass correctly
- test_security_curve now does proper client key authentication using test key
- test_security_plain now does proper password authentication
2013-09-02 18:21:36 +02:00
Pieter Hintjens
fba5612026 Fixed 'make check' failures
- Split off NULL security check from PLAIN
- Cleaned up test_linger code a little
- Got all tests to pass, added TODOs for outstanding issues
- Added ZAP authentication for NULL test case
- NULL mechanism was not passing server identity - fixed
- cleaned up test_security_plain and removed option double-checks (made code ugly)
- lowered timeout on expect_bounce_fail to 150 msec to speed up checks
- removed all sleeps from test_fork and simplified code (it still passes :-)
2013-09-02 17:22:24 +02:00
Pieter Hintjens
01b336f1f1 Whitespace fixes 2013-09-02 15:08:40 +02:00
Pieter Hintjens
c128fac7a7 Merge pull request #639 from minrk/test_linger
add test_linger
2013-09-02 06:06:58 -07:00
Pieter Hintjens
6fa274ebef Merge pull request #640 from mattconnolly/fork
Adding ability for a context to be terminated in a forked child process
2013-09-02 06:06:31 -07:00
Matt Connolly
1771755888 test_fork.cpp: adding missing headers for linux 2013-09-02 07:13:46 +10:00
MinRK
c646ac96c0 cast rc to size_t for comparisons
avoids -Wall failures comparing int to uint
2013-09-01 13:50:18 -07:00
Matt Connolly
a3d9d01af8 test_fork: update test to verify communication between parent and child 2013-09-01 20:42:19 +10:00
Matt Connolly
0478ee04f4 Adding test showing failure to close socket/context in forked child 2013-09-01 20:42:10 +10:00
MinRK
58b370df69 add test_linger
tests that default LINGER (-1) ensures message delivery.

Note: it fails for large messages ( > 1MB, depending on the system).
2013-08-31 18:27:50 -07:00
MinRK
9d94640edc test failed CURVE auth
adds expect_bounce_fail test function

which is like bounce, but fails if messages arrive.
2013-08-30 17:56:59 -07:00
MinRK
0cac56fe52 test PLAIN auth with failed login
This test fails because PLAIN authentication doesn't actually reject connections
2013-08-30 15:28:16 -07:00
Guido Goldstein
93a068a832 Fixed silly port number. 2013-08-29 20:55:23 +02:00
Pieter Hintjens
2e9385ac02 Merge pull request #631 from jrossi/master
Add the Socket Identity info to the ZAP Messages
2013-08-21 01:35:43 -07:00
Ian Barber
d485404aab Merge pull request #626 from dkrikun/master
Add ZMQ_CONFLATE socket option
2013-08-20 14:37:52 -07:00
Jeremy Rossi
19ca8a0fc0 Add the Socket Identity info to the ZAP Messages
This change adds the socket identity infomartion from the socket to the
zap frames.  In doing this the ZAP is able preform different operations
based on different sockets.  This is not compaitable with the current ZAP
RFC, but that can be updated.  As the ZAP rfc is currently draft for I
did not change the version number.

Tests also modified and passing.
2013-08-20 13:48:05 -04:00
danielkr
3f3777d05b Add test for ZMQ_CONFLATE option 2013-08-19 15:34:11 +03:00
Pieter Hintjens
1011e8ad20 Merge pull request #624 from ricnewton/master
Port tests to windows and add to cmake build.
2013-08-18 00:51:39 -07:00