Commit Graph

2856 Commits

Author SHA1 Message Date
Simon Giesecke
f22b0b7483 Problem: test_monitor failing for assertion on endpoint addresses on ZMQ_EVENT_LISTENING event
Solution: fix address passed and refactor set_local_address to remove code duplication and unnecessary address parsing when ZMQ_USE_FD is used
2019-02-02 18:33:29 +01:00
Simon Giesecke
54240dccbb Problem: stream listeners do not provide correct local and remote address information (test_monitor is failing)
Solution: query local and remote addresses on accepting a connection
2019-02-02 16:52:15 +01:00
Simon Giesecke
d8b5204f73 Problem: socks_connecter_t does not set local address
Solution: query the local address and set it
2019-02-02 15:33:27 +01:00
Simon Giesecke
87082557f0 Problem: stream_connecter_base_t does not set local address
Solution: pass the local address by subclasses to create_engine
2019-02-02 15:33:27 +01:00
Simon Giesecke
aec9b130f7 Problem: get_socket_address and get_socket_name not available throughout libzmq and restricted to local address
Solution: move to address.hpp/.cpp and generalize
2019-02-02 15:33:27 +01:00
Simon Giesecke
01371398e9 Problem: monitor events are unversioned
Solution: add monitor event socket option
2019-02-02 15:33:27 +01:00
Simon Giesecke
2e73554644 Problem: socks_connecter_t, vmci_connecter_t and vmci_listener_t duplicate code with stream_*_base_t
Solution: add TODO comments to resolve this debt
2019-02-02 15:23:56 +01:00
Simon Giesecke
b462cc0912 Problem: misleading comments referring to a "library shutdown"
Solution: change to refer to the context
2019-02-02 15:23:56 +01:00
Simon Giesecke
9a376fbe24 Problem: code duplication in get_address of ipc/tcp/tipc listener classes
Solution: pull up to base class
2019-02-02 15:23:56 +01:00
Simon Giesecke
e162c8bda3 Problem: code duplication around getsockname
Solution: also use get_socket_address from base class
2019-02-01 04:58:57 -05:00
Simon Giesecke
2b04946f49 Problem: code duplication around getsockname
Solution: also use get_socket_address from base class
2019-02-01 04:58:57 -05:00
Simon Giesecke
c476cf3d14 Problem: implicit cast between signed and unsigned types on some platforms
Solution: perform explicit cast
2019-02-01 04:58:57 -05:00
Simon Giesecke
95eb8a7a99 Problem: parts of in_event duplicated across subclasses of stream_listener_base_t
Solution: extract function create_engine into base class
2019-02-01 04:58:57 -05:00
Simon Giesecke
93c1843f3e Problem: duplication across ipc_listener_t, tcp_listener_t, tipc_listener_t
Solution: extract common base class stream_listener_base_t
2019-02-01 04:58:57 -05:00
Simon Giesecke
a40a3b7a34 Problem: several data members in stream_connecter_base_t are visible more than necessary
Solution: make them private and adapt initialization order
2019-02-01 04:58:57 -05:00
Simon Giesecke
a766a4b67e Problem: reconnect_timer_id duplicated and essentially used only in base class
Solution: removed definitions and uses in subclasses
2019-02-01 04:58:57 -05:00
Simon Giesecke
bed3b0cfb4 Problem: tipc_listener_t data members not conforming to naming style
Solution: add underscore prefix
2019-02-01 04:58:57 -05:00
Simon Giesecke
2a5fb6cb8e Problem: ipc_listener_t data members not conforming to naming style
Solution: add underscore prefix
2019-02-01 04:58:57 -05:00
Simon Giesecke
7e73587741 Problem: duplication in *_event methods across subclasses of stream_connecter_base_t
Solution: pull up common code, introduce new create_engine function in base class
2019-02-01 04:58:57 -05:00
Simon Giesecke
a09099a615 Problem: process_term and close duplicated across subclasses of stream_connecter_base_t
Solution: pull up
2019-02-01 04:58:57 -05:00
Simon Giesecke
531df586d0 Problem: rm_fd code duplicated across stream_connecter_t subclasses
Solution: pull up tcp_connecter_t::rm_handle and use in all subclasses
2019-02-01 04:58:57 -05:00
Simon Giesecke
1a230e89ca Problem: process_plug, get_new_reconnect_ivl and add_reconnect_timer duplicated across subclasses of stream_connector_base_t
Solution: pull up to stream_connector_base_t
2019-02-01 04:58:57 -05:00
Simon Giesecke
74667ebcba Problem: destructors of tcp_connecter_t, ipc_connecter_t, tipc_connecter_t contain duplicated code
Solution: pull up to stream_connecter_base_t
2019-02-01 04:58:57 -05:00
Simon Giesecke
d6f8d246e2 Problem: data members are duplicated across tcp_connecter_t, ipc_connecter_t, tipc_connecter_t
Solution: extract common base class stream_connecter_base_t
2019-02-01 04:58:47 -05:00
Simon Giesecke
361d7168ad Problem: tipc_connector_t::_handle_valid is redundant
Solution: replace by checks against valid value of _handle
2019-02-01 04:33:03 -05:00
Simon Giesecke
a13eb1a9d8 Problem: ipc_connector_t::_handle_valid is redundant
Solution: replace by checks against valid value of _handle
2019-02-01 04:33:03 -05:00
Simon Giesecke
065e81879a Problem: tipc_connector_t::_timer_started is unspecifically named
Solution: rename to _reconnect_timer_started
2019-02-01 04:33:03 -05:00
Simon Giesecke
ca87aaed57 Problem: ipc_connector_t::_timer_started is unspecifically named
Solution: rename to _reconnect_timer_started
2019-02-01 04:33:03 -05:00
Simon Giesecke
c94ad64876 Problem: tipc_connector_t data members not conforming to naming conventions
Solution: add underscore prefix to data members
2019-02-01 04:33:03 -05:00
Simon Giesecke
58063a75a2 Problem: ipc_connector_t data members not conforming to naming conventions
Solution: add underscore prefix to data members
2019-02-01 04:33:03 -05:00
Simon Giesecke
4d362887bb Problem: stream_engine_t::_endpoint is unnecessarily non-const
Solution: declare _endpoint const
2019-02-01 04:33:03 -05:00
Simon Giesecke
091df743a8 Problem: stream_engine_t::_peer_address is unnecssarily non-const
Solution: extract initialization code into get_peer_address function and declare _peer_address const
2019-02-01 04:33:03 -05:00
Simon Giesecke
ae79b41d4c Problem: bug in tipc_listener_t::set_address, random port is determined but not used
Solution: assign result to address

Fixes #3376
2019-02-01 04:30:20 -05:00
Simon Giesecke
afe48e2b16 Problem: unnecessary explicit definitions/deletions of special member functions in tipc_address_t
Solution: remove them
2019-02-01 04:28:35 -05:00
Luca Boccassi
bfb4a868fc Problem: atomic intrinsics unreliable on PPC64 and RISC-V
Solution: prefer CXX11 atomics if they are available to compiler
intrinsics.
test_hwm_pubsub fails 50% of the times on PPC64 and RISC-V with an
apparent memory corruption of messages sent by the application thread
to the I/O thread when using compiler intrinsics.
Switching to CXX11 atomics makes the test reliable again. The
standard API should be preferred anyway, if available.
2019-01-19 21:42:54 +00:00
Luca Boccassi
4a0c83fb12 Problem: yqueue false sharing issues on PPC64
Solution: detect cacheline size for aligment purposes at build time
instead of hard-coding it, so that PPC and S390 can align to a value
greater than the 64 bytes default.
Uses libc getconf program, and falls back to the previous value of 64
if not found.
2019-01-19 20:08:14 +00:00
Luca Boccassi
93b3689376 Problem: ZMQ_SOCKET_LIMIT and ZMQ_THREAD_PRIORITY have the same value
Solution: remove documents and tests for ZMQ_THREAD_PRIORITY getter. It
never worked and can never work as it has the same value as a get-only
option ZMQ_SOCKET_LIMIT. It cannot be changed without breaking ABI.
Note that the setter works fine as ZMQ_SOCKET_LIMIT is get-only.
2019-01-15 19:58:42 +00:00
Luca Boccassi
e9fd5aae43 Problem: small formatting issue highlighted by clang
Solution: fix it with make clang-format-diff
2019-01-09 12:02:58 +00:00
Guido Vranken
731be4bd59 Problem: Compilation error due to comparison between signed and unsigned expressions
Solution: Cast the signed expression (which is always positive) to unsigned

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
2019-01-09 12:36:28 +01:00
Guido Vranken
1a2ed12716 Problem: pointer overflow in zmq::v2_decoder_t::size_ready leading to remote code execution (issue #3351)
Solution: refactor bounds check arithmetic such that no overflow shall occur

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
2019-01-08 23:39:41 +01:00
Shubham Lagwankar
cc686f15f4 Problem: unused import and inconsistent use of const
Solution: remove unused import and fix const placement.
2019-01-02 10:25:21 -05:00
Luca Boccassi
9bd9cbbeea Problem: race condition in PUSH might break atomicity
Solution: if a multi-part message cannot be delivered by a PUSH socket
because the pipe is broken mid-way, drop the rest of the frames so that
the atomicity property is not broken.
2018-12-28 17:55:19 +01:00
Luca Boccassi
28d5ce3dfa Problem: pkg-config file cannot be used for static linking
Solution: use requires.private, which pkg-config expands recursively
so that dependencies of dependencies can be linked against when
using pkg-config --static
2018-12-15 00:44:00 +00:00
Luca Boccassi
9d06e29cb2 Problem: duplicated pkg-config template
Solution: use the same for both autotools and cmake
2018-12-14 23:27:42 +00:00
Jeremie Courreges-Anglas
687c75858e Problem: libtool -export-symbols-regexp seems to leak weak symbols
Solution: go back to using -Wl,--version-script.

Use ax_check_vscript.m4 from the autoconf-archive to detect support on
multiple platforms (eg Solaris ld(1) -M).

libtool -export-symbols-regexp used ld(1) --retain-symbols-file under
the hood, the latter lets some C++ weak symbols make their way into the
dynamic symbols table, along with the zmq_* interface.  The reason for
such behavior is unknown to me.
2018-12-14 18:48:39 +01:00
Jacques Germishuys
a1ace32650 Problem: TCP_NODELAY is set prior to connecting, which is problematic on Windows
Solution: Set TCP_NODELAY after connect()

Reference: https://mail.openvswitch.org/pipermail/ovs-dev/2014-October/290251.html
2018-12-14 11:49:05 +02:00
Henri Gourvest
a6b5c75198 Problem: Switching or desactivate wifi can lead to have EINVAL error code
returned on Android.
Solution: Avoid killing the application, allows to take
the appropriate measures to this situation.
2018-12-08 14:33:32 +01:00
Jérémie Courrèges-Anglas
70b48a9c0c Problem: --version-script not used on OpenBSD
Solution: switch to libtool symbol visibility support, which leads to
more portable constructs in the autotools glue.  As noted in the libtool
documentation "This option has no effect on some platforms."

After this commit, global symbols intended to be kept private will
disappear on platforms that were previously not handled
using -Wl,--version-script.
2018-12-07 18:58:19 +01:00
Luca Boccassi
f1dd84c11f Problem: zmq_proxy STATISTICS eligible for stable
Solution: do it
2018-11-18 13:23:38 +00:00
Luca Boccassi
35c6985e68 Problem: zmq_stopwatch_intermediate is eligible for STABLE
Solution: do it
2018-11-18 13:23:38 +00:00
Luca Boccassi
22c3ecc458 Problem: some context options have no getter
Solution: add one so that class-based bindings can easily use them
2018-11-18 13:23:38 +00:00
Luca Boccassi
92cf6c6451 Problem: new ctx THREAD options are eligible for STABLE
Solution: do it
2018-11-18 13:23:38 +00:00
Luca Boccassi
c347aef794 Problem: new DRAFT monitoring events are eligible for STABLE
Solution: do it
2018-11-18 13:23:38 +00:00
Bill Torpey
25e069d131 Add specific option to select radix tree implementation for subscriptions (#3304)
* Add specific option to select radix tree implementation for subscriptions (defaults to ON if draft API enabled).
2018-11-12 21:57:11 +00:00
Shubham Lagwankar
3659c1204a Problem: radix tree needs benchmarks and improvements (#3290)
* Problem: radix tree needs benchmarks and improvements

Solution: add a benchmark and make suggested improvements
2018-11-09 10:49:40 +00:00
KIU Shueng Chuan
9a15fe7fac use required number of descriptors (1) instead of FD_SETSIZE 2018-11-07 09:58:16 +08:00
Luca Boccassi
63abe83388
Merge pull request #3296 from sigiesec/reapply-session-base-refactoring
Reapply session_base_t refactoring
2018-11-06 21:00:26 +00:00
Simon Giesecke
db09fab47b Problem: compilation broken with Sun Studio
Solution: do not use make_pair
2018-11-06 12:33:19 +01:00
Nathan Toone
fa598579e6 Problem: Assert being triggered when Windows returns WSAENOBUFS from recv call on large buffers.
Solution: Expect `WSAENOBUFS` as a valid response.  See https://github.com/zeromq/libzmq/issues/3263
2018-11-05 16:25:35 -07:00
Simon Giesecke
c590873ff7 Problem: complexity of start_connecting
Solution: extract functions for each protocol
2018-11-05 16:06:21 +01:00
Luca Boccassi
25ded9e897 Problem: out-of-date TODO in zmq_poll
Solution: remove it
2018-11-05 10:59:12 +00:00
Luca Boccassi
ab1607f813 Problem: poller implementation of zmq_poll is slow
Solution: use it only if there is at least one thread-safe socket,
which is not compatible with the older zmq_poll implementation.
2018-11-05 10:59:12 +00:00
Luca Boccassi
bd9011fe3b Problem: build broken with Sun Studio
Solution: temporary revert refactoring until it can be properly fixed.

Revert "Problem: complexity of start_connecting"

This reverts commit 6d7aeb056f.
2018-11-05 10:58:45 +00:00
Luca Boccassi
8f69122981 Problem: new radix tree implementation is experimental
Solution: use it only for DRAFT builds for now, to leave it time to be
tested and stabilised.
2018-10-31 14:47:57 +00:00
Shubham Lagwankar
c68afb412e Problem: potentially large memory footprint of trie as number of
subscriptions increases

Solution: use a radix tree instead of a trie to store subscriptions
2018-10-31 07:49:55 -04:00
Bunjevacki, Jovan
f5d1d5d1af Problem: Use of pipe_t after free in zmq::socket_base_t::term_endpoint(). Issue #3245.
Solution: When pipe_t is freed (terminated) remove it from _endpoints member of zmq::socket_base_t. Resolves issue #3245.
2018-10-30 14:12:29 +01:00
Conrad Parker
22083d7d62 Problem: UDP does not support ZMQ_MULTICAST_HOPS
Solution: add support for ZMQ_MULTICAST_HOPS (IP_MULTICAST_TTL)
2018-10-30 08:14:26 +00:00
Luca Boccassi
cfc9d5f519 Problem: trailing whitespace breaks clang-format-check
Solution: fix issue introduced by #3270
2018-10-08 17:17:13 +01:00
gabm
c1ac158f50 Problem: The flag that indicates the next expected message gets set even if the send fails (#3270)
* ZMQ_DGRAM: flip more flag after successful send

In the dgram socket we have a flag that indicates the next expected message type to ensure that always a pair of "address" + "body" messages gets sent. The first one MUST have the sendmore flag, the second MUST NOT.

In case the message does not get sent because of HWM full, then the function returns EAGAIN as it should. But unfortunately the next expected message type-flag gets flipped as well. When the socket_base::send function now tries to resend the message, it became the wrong message type... If you don't stop sending pairs of messages here (like me) then the next message that gets through will be of the wrong type, which in turn crashes the udp_engine function as described in #3268
2018-10-08 17:14:45 +01:00
Gregory Lemercier
ffe62d3398 Fix build on arm64 architectures with some strict compilers
This patch fixes an issue that occurs on 64-bit architetures under
strict compiler rules. The code initially checked that the received
size stored in 'uint64_t' was not bigger than the max value of a
'size_t' variable, which is legitimate on 32-bit architectures where
'size_t' variables are stored on 32 bits. On 64-bit architectures,
this test no longer makes sense since 'uint64_t' and 'size_t' types
have the same size. The issue is fixed by ignoring this portion
of code when built for arm64.
2018-10-07 18:23:08 +02:00
Luca Boccassi
e0ec6a9b36 Problem: formatting errors introduced by PR #3237
Solution: fix them
2018-08-31 09:37:53 +01:00
Byron Mallett
d8f3b283f8 Added SO_REUSEPORT socket option for UDP recv ports (#3237)
* Added SO_REUSEPORT socket option for UDP multicast recv ports
2018-08-31 09:36:34 +01:00
Aalhad Saraf
3f1f628538 Fix build failure on ARM due to bad variable name
The variable decrement was changed to decrement_
in c581f43c97

In -one- place, it remained as decrement
and gives:

In file included from src/ctx.hpp:44:0,
from src/address.cpp:33:
src/atomic_counter.hpp: In member function 'bool zmq::atomic_counter_t::sub(zmq::atomic_counter_t::integer_t)':
src/atomic_counter.hpp:191:28: error: 'decrement' was not declared in this scope

Changing it to decrement_ fixes the problem.
2018-08-23 17:02:56 +05:30
Luca Boccassi
9f0b83a1d3 Problem: whitespace issue with PR #3227
Solution: fix it to comply with clang-format rules
2018-08-20 15:44:20 +01:00
answeroo
777bd48296 Pgm fix (#3227)
* Relicensing grant by Ming Ji <jiming@yafco.com>

Permission to relicense under any OSI approved license chosen by the current ZeroMQ BDFL.
2018-08-20 15:42:58 +01:00
Luca Boccassi
d7e51cdfed Problem: indentation issues with PR #3226
Solution: fix them
2018-08-19 18:12:28 +01:00
answeroo
7852a6ce98 PGM receiver crash fix (#3226)
Problem: PGM receiver can crash due to race

Solution: do not run in_event until restart_input finishes correctly.

Signed-off-by: answeroo <jiming@yafco.com>
2018-08-19 18:10:51 +01:00
Simon Giesecke
8328208e60 Problem: inconsistent _out_pipes when using the same routing id without ZMQ_ROUTER_HANDOVER
Solution: added test case, do not erase existing without ZMQ_ROUTER_HANDOVER
2018-08-17 12:50:59 +02:00
Simon Giesecke
6d7aeb056f Problem: complexity of start_connecting
Solution: extract functions for each protocol
2018-08-15 14:46:21 +02:00
Simon Giesecke
2cd34da1b0 Problem: code duplication in session_base_t::start_connecting
Solution: extract common code
2018-08-15 14:46:21 +02:00
Simon Giesecke
799fae44fe Problem: magic literal used for inproc
Solution: define and use named constant
2018-08-15 14:46:21 +02:00
Simon Giesecke
daadb65a46 Problem: inconsistency of using terms address and uri
Solution: use terms more consistently
2018-08-15 14:46:21 +02:00
Simon Giesecke
cdc6c66f9b Problem: complexity of term_endpoint
Solution: extract resolve_tcp_addr function
2018-08-15 14:46:21 +02:00
Simon Giesecke
a2d736c14f Problem: functionality around inprocs_t is scattered
Solution: extract into functions of new inprocs_t class
2018-08-15 14:46:21 +02:00
Simon Giesecke
fb576d2f95 Problem: unnecessary procedural code
Solution: replace by functional expression
2018-08-15 14:46:21 +02:00
Simon Giesecke
3455be144d Problem: code duplication around sending of routing id
Solution: extract functionality into send_routing_id
2018-08-15 14:46:21 +02:00
Simon Giesecke
83f41526c9 Problem: code duplication around options_t::conflate
Solution: extract functionality into get_effective_conflate_option
2018-08-15 12:18:35 +02:00
Simon Giesecke
8820dedcb7 Problem: stream_engine_t::_as_server is not used
Solution: remove it
2018-08-15 11:53:31 +02:00
Simon Giesecke
0852099f67 Problem: unused field pipe_t::_credentials
Solution: remove it
2018-08-15 11:48:00 +02:00
Szekely Gyorgy
2cdad3d0ce Add ZMQ_ROUTER_NOTIFY draft socket option (#3213)
* Add ZMQ_ROUTER_NOTIFY draft socket option
2018-08-15 08:54:08 +01:00
Simon Giesecke
da30ff7d3d Problem: unused get_credential methods and associated fields
Solution: remove them
2018-08-13 15:22:18 +02:00
Luca Boccassi
0b1589dbba
Merge pull request #3209 from sigiesec/code-improvements
Code style improvements
2018-08-10 16:40:23 +01:00
Simon Giesecke
bbae67df89 Code style improvements 2018-08-10 15:36:31 +02:00
Simon Giesecke
b102e30419 Fixed naming for filter parameter, removed unnecessary temporary variable, fixed naming of local variable 2018-08-10 11:25:20 +02:00
Simon Giesecke
a1b6268c83 Made to_string const; converted C-style cast to reinterpret_cast 2018-08-10 11:25:09 +02:00
Luca Boccassi
6e8424ab5d
Merge pull request #3206 from sigiesec/fix-zap-memory-use-after-free
Problem: stream_engine_t instance may access its fields after it deleted itself
2018-08-09 18:17:58 +01:00
Simon Giesecke
737927e333 Fixed spelling of parameter 2018-08-09 18:27:01 +02:00
Simon Giesecke
46ed0920b2 Various code style improvements 2018-08-09 18:27:01 +02:00
Simon Giesecke
563651e0c9 Problem: stream_engine_t instance may access its fields after it deleted itself
Solution: prevent access to data if the object was deleted
2018-08-09 15:24:23 +02:00
Simon Giesecke
be81dcd4d3 Use std::min/max where possible 2018-08-09 12:53:32 +02:00