Commit Graph

322 Commits

Author SHA1 Message Date
Paul Thiele
6737d50933 Problem: if ZMQ_XPUB_VERBOSER is used with proxies unsubscribe messages are lost
Solution: add socket option ZMQ_XSUB_VERBOSE_UNSUBSCRIBE to forward all unsubscribe messages
2021-11-05 15:12:31 +01:00
E. G. Patrick Bos
36e4c9b474
add zmq_ppoll
zmq_ppoll mostly mimics zmq_poll behavior, except for the added feature of being able to specify a signal mask. Signals in this mask will be blocked during execution of zmq_ppoll. Switching of the process' active signal mask happens atomically with the actual poll call, so that no race conditions can occur. This behavior is useful when one wants to gracefully handle POSIX signals without race conditions. See e.g. the discussion below https://250bpm.com/blog:12/ for an explanation.

Also includes two new tests:
1. test_zmq_ppoll_fd does the same thing as test_zmq_poll_fd, demonstrating backwards compatibility with zmq_poll when used with a default signal mask.
2. test_zmq_ppoll_signals demonstrates the use of zmq_ppoll with a signal mask, blocking out SIGTERM everywhere except in zmq_ppoll, allowing to handle the signal in one place without having to worry about race conditions.
2021-09-24 11:04:20 +02:00
Luca Boccassi
276bab8d3b Problem: test_socks and test_proxy hang under valgrind in Github Actions
Solution: skip them
2021-09-22 16:40:17 +01:00
Doron Somech
1c6c5514ed problem: no way to know when connection is temporarly dropped
This is important in order to send the login sequence of a client to the server.

Solution: add ZMQ_HICCUP_MSG to a socket, socket would send that message whenever a connection get temporarly disconnected
2021-06-06 17:14:22 +03:00
Luca Boccassi
38bb82b0c8 Problem: vmci tests built in repo root
Solution: move them with the rest
2021-02-20 21:38:02 +00:00
Luca Boccassi
16af1bd622 Problem: test_pubsub broken everywhere
Solution: disable it
2021-01-18 09:42:33 +00:00
mjvankampen
2dd24d6d80
Problem: norm fails to compile under windows (#4123)
* Makes norm useable (but maybe slow) on windows
2021-01-18 08:42:14 +00:00
Luca Boccassi
2347a76413 Problem: build broken on debian/hurd
Solution: fix it
2021-01-16 17:48:29 +00:00
Luca Boccassi
e708623c12 Problem: no fuzzing coverage for ZMQ_STREAM
Solution: add tests
2020-09-06 11:05:15 +01:00
Simon Giesecke
c6301206dc Problem: no tests for ZMQ_TCP_ACCEPT_FILTER
Solution: add some tests
2020-09-04 15:51:33 +02:00
Luca Boccassi
f43013a7d1 Problem: no fuzz testing for options
Solution: add it
2020-08-21 15:25:55 +01:00
Luca Boccassi
a4dbdb614e Problem: some platforms do not have strnlen
Solution: move compat redefinition to compat.hpp header so that
it can be used from msg.cpp
2020-08-21 14:39:08 +01:00
Luca Boccassi
eb9118f0c9 Problem: no fuzz testing for websockets
Solution: add tests for plain WS
2020-07-05 23:43:58 +01:00
Luca Boccassi
e95e57d385 Problem: fuzzer corpus file can be quite large
Solution: move all corpora to the zeromq/libzmq-fuzz-corpora repository
for easier handling, and to avoid inflating the size of zeromq/libzmq.
Clone it for the CI on the fly.
2020-07-04 17:50:35 +01:00
Luca Boccassi
2d23b599f2 Problem: test_bind_fuzzer does not use corpus for regression tests
Solution: do it
2020-05-16 15:01:15 +01:00
Doron Somech
3da84c6d06 problem: no thread-safe alternative for ZMQ_PAIR
Solution: create ZMQ_CHANNEL, the thread safe alternative
2020-05-09 08:49:01 +03:00
Luca Boccassi
5b7f67a822 Problem: memory sanitizer not enabled in CI
Solution: add -fsanitize=leak to the sanitizers flag, and disable
test_many_sockets as it currently fails due to:
https://github.com/zeromq/libzmq/issues/3898
2020-05-06 00:14:02 +01:00
Luca Boccassi
9ab3fbeee2 Problem: we want to have multiple seed corpora per fuzzer binary
Solution: store them each as a single line in the text file and convert them
at install time
2020-05-05 11:48:11 +01:00
Luca Boccassi
c8e62cb2e0 Problem: no dictionaries and seed corpora for fuzzers
Solution: add them and install them where oss-fuzz expects them
2020-05-04 02:11:15 +01:00
Luca Boccassi
96787c35f8 Problem: no fuzz testing for API with variable input
Solution: add tests for zmq_bind, zmq_connect and zmq_z85_decode
2020-04-27 01:18:45 +01:00
Luca Boccassi
57df836381 Problem: no fuzz testing for CURVE
Solution: add simple, initial tests for client and server
2020-04-27 01:18:31 +01:00
Luca Boccassi
8e774f3cd6 Problem: no integration with fuzz testing
Solution: port the 2 new tests from oss-fuzz, and wire them up to
be ran manually with a static input in normal builds.
Add a specific configure option to use the external fuzzing engine
from oss-fuzz.
2020-04-27 01:18:08 +01:00
Doron Somech
81444136d5 problem: router doesn't know when peer disconnected
ZMQ_ROUTER_NOTIFY doesn't have a context and doesn't play nice with protocols. with ZMQ_DISCONNECT_MSG we can set it to a protocol message, like DISCONNECT in majordomo. Router will send it when a peer is disconnected. Another advantage of ZMQ_DISCONNECT_MSG is that it also works on inproc.

Together with ZMQ_HEARTBEAT it allows to build very reliable protocols, and much simpler as well.
2020-04-17 18:04:28 +03:00
Doron Somech
93da6763b0 problem: ZMQ_HEARTBEAT is not useful without sending an hello message
When using ZMQ_HEARTBEAT one still needs to implement application-level heartbeat in order to know when to send a hello message.
For example, with the majordomo protocol, the worker needs to send a READY message when connecting to a broker. If the connection to the broker drops, and the heartbeat recognizes it the worker won't know about it and won't send the READY msg.
To solve that, the majordomo worker still has to implement heartbeat. With this new option, whenever the connection drops and reconnects the hello message will be sent, greatly simplify the majordomo protocol, as now READY and HEARTBEAT can be handled by zeromq.
2020-04-17 14:54:58 +03:00
Gudmundur Adalsteinsson
7b1fef28f9
Problem: boilerplate when init msg from data copy (#3860)
* Problem: boilerplate when init msg from data copy

Solution: Add zmq_msg_init_buffer to construct
a message by copying memory from buffer.
2020-04-09 23:59:43 +01:00
Bill Torpey
debbe08fb8
add option to stop trying to reconnect on ECONNREFUSED (#3831)
* add option to stop trying to reconnect on ECONNREFUSED
2020-02-23 17:17:22 +00:00
Luca Boccassi
52044b38f7
Merge pull request #3823 from somdoron/ZMQ_PEER
problem: zeromq doesn't has a thread-safe peer to peer socket
2020-02-09 21:53:18 +00:00
Doron Somech
70bc7dd925 problem: zeromq doesn't has a thread-safe peer to peer socket
Solution: a new socket type, called PEER. Very similar to SERVER, but can only connect to other PEERs. Also a new zmq_connect_peer method, that connect and return a routing-id in thread-safe and atomic operation
2020-02-09 23:20:14 +02:00
Luca Boccassi
253e9dd27b Problem: libzmq does not send ZMTP 3.1 sub/cancel commands
Solution: if all peers of a socket are >= 3.1 use sub/cancel commands
instead of the old 0/1 messages.
For backward compatibility, move the handling of 0/1 or sub/cancel
command strings to the encoders, so that the right thing can be done
depending on the protocol version.
Do not set the command flag until the encoder, so that we can handle
the inproc case (which skips the encoder).
2020-02-05 17:03:39 +00:00
Simon Giesecke
b01685ea0a Problem: no unittests for curve_encoding_t
Solution: add initial tests
2020-02-03 22:24:16 +01:00
Luca Boccassi
068385c951 Problem: internal reimplementation of strlcpy used by default on Linux
Solution: use libbsd by default when available, and the internal implementation
only as a fallback, to take advantage of Linux distros maintenance of the
string libraries.
2019-12-28 16:21:06 +01:00
Luca Boccassi
a61db18eee Problem: WSS LAST_ENDPOINT returns WS transport
Solution: add wss_address_t subclass of ws_address_t to override the
to_string method
2019-11-28 12:37:53 +00:00
somdoron
7296fb5b15 problem: unsecured websocket is rarely used in production
Solution: support websocket with tls (wss)
2019-10-02 08:58:26 +03:00
somdoron
9be8334938 problem: sha1 external module conflict with czmq
Solution: allow to use external library (nss) for sha1 to avoid the conflict
2019-09-11 15:01:28 +03:00
somdoron
a48fdd6a7f problem: ws_engine doesn't send correct host and path
Solution: extract path and host from the address
2019-09-05 17:33:38 +03:00
Luca Boccassi
2fe2ce1e37 Problem: static-only test run fails
Solution: add libtestutil.a before libzmq.a in LDADD listings, as the
linker will complain about undefined symbols otherwise

Fixes https://github.com/zeromq/libzmq/issues/3646
2019-09-02 12:11:25 +01:00
Luca Boccassi
a56d36b8e5
Merge pull request #3587 from somdoron/stream_engine_base
problem: ws_engine duplicate code from stream_engine
2019-07-18 11:57:27 +01:00
somdoron
157b2a2ee0 problem: ws_engine duplicate code from stream_engine
Solution: New class called stream_engine_base which is inherited by ws_engine, zmtp_engine and raw_engine.
2019-07-18 11:28:08 +03:00
Luca Boccassi
3692b26649
Merge pull request #3579 from somdoron/zws2
problem: browser cannot communicate with zeromq directly
2019-07-16 13:28:30 +01:00
somdoron
39941a0c82 problem: browser cannot communicate with zeromq directly
Solution: implement ZWS 2.0 which websocket transport for zeromq
2019-07-16 10:12:20 +03:00
Simon Giesecke
92dbb4caee Problem: no C++ style secure memory allocator available
Solution: Added secure_allocator_t based on libsodium's memory management functions when available
2019-07-14 17:12:39 +02:00
Christophe Guillon
153418e175 Add tests for SOCKS proxy support 2019-06-13 15:35:27 +02:00
Luca Boccassi
9bcfc251f4 Problem: new test_xpub_manual_last_value not built by automake
Solution: list it
2019-05-18 16:10:12 +01:00
Simon Giesecke
5b40bdb194 Problem: redundant specific of testutil headers
Solution: remove redundant entries
2019-03-23 09:09:24 -04:00
Simon Giesecke
347708bcf2 Problem: test utilities are in headers and recompiled for every test
Solution: move test utilities to separate testutil library
2019-03-23 09:09:24 -04:00
Simon Giesecke
cbd4157638 Problem: tests without test framework
Solution: migrate to Unity
2019-03-22 12:36:28 -04:00
Simon Giesecke
9528983d95 Problem: tests without test framework
Solution: migrate to Unity
2019-03-22 12:36:24 -04:00
Simon Giesecke
90a4d268d9 Problem: tests without test framework
Solution: migrate to Unity
2019-03-22 12:07:32 -04:00
Simon Giesecke
6ed03e9333 Problem: tests without test framework
Solution: migrate to Unity
2019-03-22 12:07:14 -04:00
Simon Giesecke
75cd23d6af Problem: tests without test framework
Solution: migrate to Unity
2019-03-22 12:06:39 -04:00