0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

2729 Commits

Author SHA1 Message Date
Simon Giesecke
a6060674b4 Problem: Magic numbers "32" and "128" in tcp_address.cpp
Solution: introduced constants
2018-05-28 17:53:43 +02:00
Simon Giesecke
93e75fd695 Problem: Magic numbers "6" and "7" in null_mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
c05db7f025 Problem: Magic numbers "1" and "6" in null_mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
ff27dd01f0 Problem: Magic numbers "1" and "4" in mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
7c9d058cdb Problem: Magic number "2" in ip_resolver.cpp
Solution: introduced constant
2018-05-28 17:53:41 +02:00
Simon Giesecke
16bb62e6f7 Problem: ctx_t::_slots is a plain array
Solution: use a std::vector instead
2018-05-28 17:53:41 +02:00
Simon Giesecke
a0a60e80ca Problem: Magic number "2" in ctx.cpp
Solution: introduced constant
2018-05-28 17:53:40 +02:00
Luca Boccassi
624c142365 Problem: static analysis warning about ifdef typo
Solution: fix it
2018-05-28 12:32:23 +01:00
Simon Giesecke
d767909b50 Problem: old C-style casts used
Solution: replace by static_cast/reinterpret_cast
2018-05-27 13:24:07 +02:00
Simon Giesecke
e3c73d9881 Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
2018-05-27 13:24:07 +02:00
Simon Giesecke
06cfd0d8ad Problem: unclear why QueryPerformanceFrequency is called for every call of QueryPerformanceCounter
Solution: add a comment
2018-05-27 13:24:07 +02:00
Simon Giesecke
97ba02bc2f Problem: redundant empty dtor
Solution: removed
2018-05-27 13:24:06 +02:00
Simon Giesecke
6ef67f13e3 Problem: use of C-style casts and magic literals
Solution: replace by static_cast, and introduce appropriate constants
2018-05-27 13:24:06 +02:00
Simon Giesecke
37344d0b7c Problem: redundant old-style void argument declarations
Solution: remove
2018-05-26 09:34:45 +02:00
Simon Giesecke
12a97bb769 Problem: redundant else after return
Solution: remove else
2018-05-26 09:34:45 +02:00
Simon Giesecke
21498700ef Problem: integer literals assigned to bool variables
Solution: replace by bool literals
2018-05-26 09:34:45 +02:00
Simon Giesecke
eacc805646 Problem: complex unnecessary ternary expressions
Solution: simplify to comparison against 0
2018-05-26 09:34:44 +02:00
Simon Giesecke
1432011277 Problem: inconsistent local variable naming
Solution: configured clang-tidy check and applied fixes
2018-05-26 09:34:44 +02:00
Simon Giesecke
c581f43c97 Problem: parameter naming style inconsistent
Solution: define and apply parameter naming style: lower_case_
2018-05-26 09:34:44 +02:00
Simon Giesecke
763760988f Problem: VS2008 has no definition of UINT16_MAX
Solution: provide definition based on _UI16_MAX
2018-05-25 15:13:07 +02:00
Simon Giesecke
d90e70c1cf Problem: maximum allowed value for ZMQ_HEARTBEAT_TTL is wrong
Solution: use UINT16_MAX
2018-05-25 15:06:11 +02:00
Simon Giesecke
2ae0c4e2c5 Problem: unnecessarily complex inheritance hierarchy in decoders, warning C4355 with VS2010
Solution: make allocator a member of decoder_base_t
2018-05-24 15:17:08 +02:00
Simon Giesecke
082b6aa641 Problem: epoll not supported under Windows
Solution: Use wepoll on Windows
2018-05-23 16:25:07 +02:00
Luca Boccassi
3730833f9d
Merge pull request #3125 from sigiesec/improve-socket-inheritance
Improve socket inheritance handling
2018-05-23 13:50:39 +01:00
Simon Giesecke
2d9a8955f5 Problem: race condition in making socket non-inheritable
Solution: create sockets with WSA_FLAG_NO_HANDLE_INHERIT
2018-05-23 11:23:33 +02:00
Simon Giesecke
44da0e7e42 Problem: code duplication in making sockets non-inheritable
Solution: extracted make_socket_noninheritable function
2018-05-23 11:23:33 +02:00
Simon Giesecke
c432aada84 Problem: inconsistent error handling and unnecessary code duplication
Solution: make error handling consistent and use retired_fd to remove code duplication
2018-05-23 11:23:33 +02:00
Luca Boccassi
44b0753c5c
Merge pull request #3047 from acsearle/master
Allow EBADF on iOS #3046
2018-05-23 09:56:32 +01:00
Luca Boccassi
d02ba13576
Merge pull request #3122 from sigiesec/test-migrations
Migrated some more tests to unity and fixed some more code style issues
2018-05-22 20:37:34 +01:00
Simon Giesecke
440be28d7e Problem: unnecessary non-const variables
Solution: add const
2018-05-22 18:46:40 +02:00
Simon Giesecke
d6952ded71 Problem: unused include directives and redundant forward declarations
Solution: removed
2018-05-22 18:46:40 +02:00
Simon Giesecke
04ec6aaf28 Problem: malloc call may fail
Solution: add alloc_assert
2018-05-22 18:46:40 +02:00
Simon Giesecke
d326434b37 Problem: API poller cannot be set independently from I/O thread poller, poll I/O thread poller broken on Windows
Solution: change platform definitions to separate API poller from I/O thread poller, disallow configuring poll I/O thread poller on Windows
2018-05-22 18:36:04 +02:00
Simon Giesecke
4e616f30dd Problem: C-style casts used
Solution: replace by C++-style casts
2018-05-18 17:04:01 +02:00
Simon Giesecke
d002eb5578 Problem: analyzer does not know that zmq_abort does not return
Solution: add no-return attributes
2018-05-18 16:25:24 +02:00
Simon Giesecke
7b3acd47b2 Problem: malloc may fail in blob_t ctors
Solution: add alloc_assert calls
2018-05-18 16:25:24 +02:00
Simon Giesecke
9da0c6d62f Problem: goto jumping backwards
Solution: replace by for loop
2018-05-18 14:34:43 +02:00
Simon Giesecke
62e48f837d Problem: assignment within complex condition
Solution: restructured code, inverted condition
2018-05-18 14:34:43 +02:00
Simon Giesecke
fcee4ccdfd Problem: type of retired_fd is not fd_t (but int)
Solution: properly declared underlying type of enum declaring retired_fd
2018-05-18 14:34:43 +02:00
Simon Giesecke
f103f62630 Problem: unreachable return statement
Solution: fix #if/#else structure
2018-05-18 14:34:42 +02:00
Simon Giesecke
290d215324 Problem: stream_engine assumes options_t.type is a single byte, but its type is int
Solution: change options_t.type to int8_t
2018-05-18 14:34:42 +02:00
Simon Giesecke
e19823d83a Problem: redundant else
Solution: remove redundant else
2018-05-17 15:17:55 +02:00
Simon Giesecke
ad781319ef Problem: ternary operator used with boolean literals\n\nSolution: Use comparison with 0 instead 2018-05-17 15:17:55 +02:00
Simon Giesecke
22b72bb678 Problem: deallocate calls release after de-allocation
Solution: reduce to newly extracted function clear, which does not use the freed pointer
2018-05-17 15:05:41 +02:00
Simon Giesecke
e37fc47fb6 Problem: return value is stored but never used
Solution: add code to make non-use explicit
2018-05-17 15:05:41 +02:00
Simon Giesecke
2120f6aced Problem: ypipe_t::read is called with NULL argument
Solution: call check_read instead
2018-05-17 15:05:41 +02:00
Simon Giesecke
440d428153 Problem: single-argument ctor of blob_t is not marked explicit
Solution: add explicit
2018-05-17 13:29:27 +02:00
Antony Searle
fa027970bb Allow EBADF on iOS #3046 2018-05-16 14:59:44 +10:00
Luca Boccassi
cbd52feb48
Merge pull request #3112 from devindusoft/FixCompilation_ZMQ_ATOMIC_PTR_MUTEX
Fixed compilation with ZMQ_ATOMIC_PTR_MUTEX
2018-05-15 15:10:49 +01:00
Simon Giesecke
e78d20ff2c Problem: test_radio_dish_udp_ipv6 triggers assertion under Windows
Solution: fix handling of sockaddr in recvfrom
2018-05-15 14:53:40 +02:00
korbes
63e1e745f8 Fixed compilation with ZMQ_ATOMIC_PTR_MUTEX 2018-05-14 22:08:15 -03:00
Luca Boccassi
d81a041f18
Merge pull request #3103 from sigiesec/win-warnings-as-errors
Warnings in Windows builds
2018-05-14 22:53:04 +01:00
Simon Giesecke
d437d668c0 Problem: MSVC warnings in connection with poll
Solution: handle types properly
2018-05-14 22:25:21 +02:00
Simon Giesecke
c589f2b603 Problem: C4800 warning in socket_base.cpp
Solution: make proper boolean expression
2018-05-14 19:18:37 +02:00
Simon Giesecke
c52871f82c Problem: C4627 warning in proxy.cpp and signaler.cpp
Solution: move conditional include directive to precompiled.hpp
2018-05-14 18:07:13 +02:00
Simon Giesecke
a8095a1046 Problem: C4800 warning in ip_resolver.cpp
Solution: fix type specification
2018-05-14 18:07:13 +02:00
Simon Giesecke
95c770a275 Problem: C4099 warning in udp_engine.cpp
Solution: fix type specification
2018-05-14 17:17:11 +02:00
Simon Giesecke
bf6bde3ae3 Problem: unnecessary ifdefs regarding handling of int vs. SOCKET at various places
Solution: use a typedef instead
2018-05-14 14:58:36 +02:00
Simon Giesecke
e8877f78a9 Problem: zmq_poller_[add/modify] accept invalid events arguments silently
Solution: check and return an error on invalid arguments. Fixes #3088
2018-05-14 14:58:36 +02:00
Simon Giesecke
6b9b369469 Problem: zmq_poller_* argument check code is cloned
Solution: extract common code into functions
2018-05-14 14:34:46 +02:00
Simon Giesecke
213254cca5 Problem: inconsistent behaviour of zmq_poller_new in case of memory exhaustion
Solution: return NULL and set errno to ENOMEM
2018-05-14 11:29:24 +02:00
Simon Giesecke
00d25b7873 Problem: inconsistent behaviour of zmq_poller_add and zmq_poller_add_fd in case of memory exhaustion
Solution: always return -1 with errno == ENOMEM
2018-05-14 11:29:24 +02:00
Luca Boccassi
b331caad06 Problem: ZMTP 3.1 PING Context not implemented
Solution: if a PING message contains a context, echo it back in the
PONG message. In order to do so, create the PONG message when PING
is received and store it in the engine.
After the PING the engine goes straight to encoding and sending, so
there can always be at most one pending PING.
Add tests for various contexts.
2018-05-14 10:14:13 +02:00
Luca Boccassi
5482b1ca45 Problem: heartbeat command parsing does not check command name size
Solution: treat the first byte of the command body as the size of the
command name, rather than as an id, to comply with ZMTP 3.1.
This was not an actual problem at runtime since both heartbeat
commands have a size of 4, which was treated like an id.
But once SUBSCRIBE/UNSUBSCRIBE get implemented it needs to be checked.
2018-05-14 09:15:39 +02:00
Luca Boccassi
09f700f72e Problem: uninitialised class variable warning
Solution: initialise it
2018-05-13 18:24:50 +01:00
Luca Boccassi
7ba074fa28 Problem: Sun Studio build errors
Solution: add compiler flags to support extensions like anonymous
structs in unions, fix casting of const, and check for suncc rather
than solaris
2018-05-13 18:24:50 +01:00
Lionel Flandrin
a833ace204 Problem: no way to specify source interface for UDP multicast sender sockets
Solution: if a binding interface is provided in the sender URL we pass
it to IP[V6]_MULTICAST_IF setsockopt
2018-05-13 18:32:12 +02:00
Luca Boccassi
b78cfb2395 Problem: mismatching declarations and definitions break Solaris Studio build
Solution: add missing const qualifier to internal functions
2018-05-13 13:17:20 +01:00
Luca Boccassi
8b82ed50a2 Problem: Solaris Studio does not convert from char * to string
Solution: do it explicitly to fix build on Solaris 10/11 with the Sun
compiler
2018-05-13 13:16:37 +01:00
Simon Giesecke
3d9c119543 Problem: compilation broken on Solaris
Solution: remove constness on pair arguments. Fixes #3090
2018-05-13 13:15:32 +01:00
Simon Giesecke
d6433b5c24 Problem: warnings in MSVC builds around size_t/int
Solution: use proper types
2018-05-13 11:11:19 +02:00
Lionel Flandrin
99412c810d Problem: ZMQ doesn't expose the MULTICAST_LOOP socket option
Solution: add a new ZMQ_MULTICAST_LOOP option for UDP sockets.
2018-05-10 19:24:46 +02:00
Lionel Flandrin
b0df4be51c Problem: UDP engine does not support IPv6
Solution: Add IPv6 support
2018-05-09 12:06:23 +02:00
Lionel Flandrin
746d4a0f5e Problem: UDP transport doesn't let the user specify the local bind address
for multicast

Solution: augment the UDP URL syntax to accept an interface specifier with a
syntax similar to the PGM urls.

Fixes #2212
2018-05-04 14:36:18 +02:00
Lionel Flandrin
524affc4c3 Problem: UDP address parser uses ad hoc code to detect multicast address
Solution: factor the code into ip_resolver, add IPv6 support and unit tests.
2018-05-04 10:44:01 +02:00
Lionel Flandrin
2dc8579412 Problem: the UDP address code uses an ad hoc custom parser
Solution: replace it with the ip_resolver code shared with the TCP
address code

It simplifies the UDP parsing code and makes it behave more like the
TCP counterpart, in particular it's not possible to connect to hosts
by name and bind by NIC names.

It also adds support for "*" port resolving to 0 (useful to let the OS
allocate the port number).
2018-05-03 14:22:48 +02:00
Lionel Flandrin
406c348771 Problem: ip_resolver allows wildcard ports for non-bindable sockets
Solution: return an error in this situation but still allow using an explicit
"0" if somebody really wants to connect to port 0.

This shouldn't break any existing code because a "*" port was already rejected
in an early test in the TCP path in zmq::socket_base_t::connect.
2018-05-03 13:19:22 +02:00
Lionel Flandrin
4cd2c2ebf8 Problem: address parsing code is tied to the TCP code
Solution: Factor the code into a different file with a well defined API and add
unit tests.
2018-05-02 18:06:01 +02:00
Luca Boccassi
cae6434345 Problem: HEARTBEAT command breaks REQ connection
Solution: ignore command messages in the REQ session to avoid
disrupting the state machine.
Commands are handled by the engine before handing off to the session.
2018-04-28 15:25:24 +01:00
Maks Naumov
989dfc7801
Fix fd_t variable casting on Windows platform
event_accepted() already accepts fd_t type and there is no reason to cast it to int type
Moreover, on Windows x64 this leads to truncation memsize -> int
2018-04-19 12:38:06 +03:00
asafkahlon
8e8009ec5d Implement the wsa_error_no function with switch-case (#3044)
* Implement the wsa_error_no function with switch-case

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
2018-04-13 15:16:54 +01:00
Marc Sune
c7d602a29b Problem: C++ style comments in header file breaks pedantic build
Solution: change missing comments in header file
Fixes: #3036 and adds on top of '15905c5'
2018-04-03 22:58:36 +02:00
Luca Boccassi
15905c5561 Problem: C++ style comments in C file breaks pedantic build
Solution: change comments
Fixes: #3036
2018-04-02 21:52:01 +01:00
Simon Giesecke
87fbb5c447 Problem: socket poller shutdown asserts when context is terminating
Solution: do not call getsockopt to query thread-safety of a socket
2018-03-28 11:23:08 +02:00
Luca Boccassi
6f26a33359 Problem: 4.2.5 is out, we need to restore API changes and 4.3.x
Solution: revert the revert!

Revert "Problem: regression in 4.2.3 went unnoticed, want to release 4.2.5"

This reverts commit 5f17e26fa4c60c3de0282d1b6ad1e8b7037ed57a.
2018-03-23 19:31:42 +00:00
Luca Boccassi
5f17e26fa4 Problem: regression in 4.2.3 went unnoticed, want to release 4.2.5
Solution: revert DRAFT -> STABLE API transition so that we can do a
bugfix-only 4.2.5 release.
Will be re-reverted once tagged.

Revert "Problem: ZMQ_BINDTODEVICE has met STABLE conditions"

This reverts commit 3cb79f5042cf32cdb7b1b58d4acf17eba85ec9f7.

Revert "Problem: ZMQ_MSG_GSSAPI_* have met STABLE conditions"

This reverts commit 374da4207b8034b0fcd67a2cc2165d50e09b9387.

Revert "Problem: ZMQ_MSG_T_SIZE has met STABLE conditions"

This reverts commit 6411c4a247c08ead50919d16b30eb030eaf44a7e.

Revert "Problem: docs say STABLE API still in DRAFT"

This reverts commit 9f2f30b7ffa09acc51d3b87251a47e83b435d5d4.
2018-03-23 11:22:10 +00:00
Luca Boccassi
1c5a63e939 Problem: backward incompatible change to NULL with ZAP
Solution: like for other mechanism, do not enforce strict ZAP protocol
adherence unless the specific socket option is enabled with NULL auth.

Add test to exercise this functionality, and fix ZAP test to set the
socket option when it uses NULL auth.

See: https://github.com/zeromq/pyzmq/pull/1152
2018-03-22 19:27:23 +00:00
Luca Boccassi
3cb79f5042 Problem: ZMQ_BINDTODEVICE has met STABLE conditions
Solution: move them from DRAFT to STABLE since it's been in a public
release, committed for 6+ months and has not changed.
2018-03-21 16:45:41 +00:00
Luca Boccassi
374da4207b Problem: ZMQ_MSG_GSSAPI_* have met STABLE conditions
Solution: move them from DRAFT to STABLE since it's been in a public
release, committed for 6+ months and has not changed.
2018-03-21 16:45:41 +00:00
Luca Boccassi
6411c4a247 Problem: ZMQ_MSG_T_SIZE has met STABLE conditions
Solution: move it from DRAFT to STABLE since it's been in a public
release, committed for 6+ months and has not changed.
Given a new STABLE symbol has been added, bump minor version number.
2018-03-21 16:45:41 +00:00
Pontus Sköldström
6a5af3dae6 Removed unnecessary errno_assert 2018-03-20 14:35:24 +01:00
Pontus Sköldström
65a9670065 Problem: ZMQ_DISH over UDP triggers errno_assert() after hitting watermark 2018-03-19 17:46:48 +01:00
Luca Boccassi
8f5fc705e4 Problem: global random init/deinit breaks existing applications
Solution: restrict it only to the original issue #2632, Tweetnacl on
*NIX when using /dev/urandom, ie: without the new Linux getrandom()
syscall.

Existing applications might use atexit to register cleanup functions
(like CZMQ does), and the current change as-is imposes an ordering
that did not exist before - the context MUST be created BEFORE
registering the cleanup with atexit. This is a backward incompatible
change that is reported to cause aborts in some applications.

Although libsodium's documentation says that its initialisation APIs
is not thread-safe, nobody has ever reported an issue with it, so
avoiding the global init/deinit in the libsodium case is the less
risky option we have.

Tweetnacl users on Windows and on Linux with getrandom (glibc 2.25 and
Linux kernel 3.17) are not affected by the original issue.

Fixes #2991
2018-03-19 15:47:07 +00:00
Pontus Sköldström
dd5eec35be Support application metadata through ZMQ_METADATA
Lets the application set per-connection metadata.
Metadata is specified as "X-key:value" and set using zmq_setsockopt, eg:
zmq_setsockopt (s, ZMQ_METADATA, "X-key:value", 11);

The peer can then obtain the metadata from a received message:
char *data = zmq_msg_gets(msg, "X-key");
2018-03-14 12:56:15 +01:00
Sergey Kachanovskiy
9c748f1bf1 Partial fix for issue 2963, removed invalid casts from fd_t to int (#2984)
* Fixes issue 2963, ref stream_engine.cpp:981

* Fixes issue 2963, ref socks_connecter.cpp:158

* Fixes issue 2963, ref tcp_listener.cpp:144

* Fixes issue 2963, ref tcp_connecter.cpp:423

* Fixes issue 2963, ref socks_connecter.cpp:436

* Fixes issue 2963, ref tcp_listener.cpp:179

* Fixes issue 2963, ref tcp_listener.cpp:268

* Fixes issue 2963, ref tcp_connecter.cpp:160
2018-03-12 11:55:58 +01:00
Luca Boccassi
8d544ef1c4 Problem: formatting issues in the CI
Solution: commit clang-format-diff
2018-03-10 12:44:27 +00:00
Luca Boccassi
fef99d6c50 Problem: tweetnacl is external code and clang-format parses it
Solution: add pragma to make clang-format ignore the external code
2018-03-10 12:43:34 +00:00
Manuel Segura
4726f7262d Pull request to merge porting to WindRiver VxWorks 6.x (#2966)
* Problem: Still need to port over more files to VxWorks 6.x

Solution: Port more files to VxWorks 6.x

* Problem: Need to port over remaining files to VxWorks 6.x. Also remove POSIX thread dependency for VxWorks (because of priority inversion problem in POSIX mutexes with VxWorks 6.x processes)

Solution: Port over remaining files to VxWorks 6.x. Also removed POSIX thread dependency for VxWorks

* Problem: Needed to modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x.

Solution:  Modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x
2018-03-10 11:03:02 +00:00
Kachanovskiy
90342e0d29 Fixed issue #2979 2018-03-09 22:24:23 +01:00
Pontus.Skoeldstroem
7abb8388d6 Problem: Tests for different TIPC address types missing (#2956)
* Tests for different TIPC address types and code cleanup

* Adds tests for binding/connecting with different TIPC address types
  using Unity
* Adds error checking for address type misuse
2018-03-07 17:31:26 +00:00
Simon Giesecke
cef9cfa091
Revert "Problem: mis-detection of threadsafe_static_init causes test failures" 2018-03-07 15:03:07 +01:00
Luca Boccassi
9bd2d3f937 Problem: mis-detection of threadsafe_static_init causes test failures
Solution: do not rely __cplusplus >= 201103L to detect whether the
compiler supports thread safe static initialisation, but check only
the proper feature preprocessor macro.
GCC introduced it in version 8, and Clang in version 6.
2018-03-06 23:11:03 +00:00
Luca Boccassi
e0b1992dd7 Problem: build broken with gcc-4.7
Solution: initialise variable in options.cpp to dummy value to fix
compiler complaint:

 src/options.cpp: In function
  'int zmq::do_setsockopt_int_as_bool_strict(const void*, size_t, bool*)':
 src/options.cpp:121:5: error: 'value' may be used uninitialized in
  this function [-Werror=maybe-uninitialized]
 src/options.cpp: In function
  'int zmq::do_setsockopt_int_as_bool_relaxed(const void*, size_t, bool*)':
 src/options.cpp:135:31: error: 'value' may be used uninitialized in
  this function [-Werror=maybe-uninitialized]
2018-03-06 20:29:47 +00:00
Luca Boccassi
ec58ba04f3
Merge pull request #2972 from sigiesec/reduce-sockopt-code-duplication
Problem: code duplication in getsockopt/setsockopt
2018-03-06 20:08:46 +00:00
Simon Giesecke
6f967c3a13 Problem: code duplication in getsockopt/setsockopt
Solution: extracted common code into do_getsockopt/do_setsockopt functions
2018-03-06 16:41:30 +01:00
Luca Boccassi
10d2b2885e
Merge pull request #2971 from ZMQers/fix-static-init
Problem: static initialization order fiasco
2018-03-06 09:18:52 +00:00
Luca Boccassi
541ca30d8e Problem: make clang-format still shows error in the CI
Solution: run make clang-format-diff and commit the changes.
2018-03-05 22:41:11 +00:00
Luca Boccassi
4ea1e78d9d
Merge pull request #2969 from skaes/master
Problem: enormous memory increase due to zero copy decoding
2018-03-05 17:40:33 +00:00
Stefan Kaes
fcbd2a5710 Problem: enormous memory increase due to zero copy decoding
The zero copy decoding strategy implemented for 4.2.0 can lead to a large
increase of main memory usage in some cases (I have seen one program go up to
40G from 10G after upgrading from 4.1.4). This commit adds a new option to
contexts, called ZMQ_ZERO_COPY_RECV, which allows one to switch to the old
decoding strategy.
2018-03-05 18:13:28 +01:00
Ryan Hileman
3658b2b580 Problem: pthread condvar timeouts are broken (#2967)
* fix pthread condvar timeouts

This fixes a race condition / hang for threadsafe sockets.
Context: https://github.com/zeromq/czmq/issues/1873#issuecomment-370279244
2018-03-05 16:36:10 +00:00
Simon Giesecke
8cdfc8b9dd Problem: static initialization order fiasco
Solution: use local statics when available in a thread-safe implementation
2018-03-05 16:30:57 +01:00
Simon Giesecke
9cd01bb54f Problem: inconsistent return values from mtrie_t::rm
Solution: Return an enum from rm instead of a bool, and adapt existing uses
2018-03-02 13:42:50 +01:00
Simon Giesecke
36cdcc6c1a Problem: docs of mtrie referring to subscriptions and pipes
Solution: generalized terms to entries/values
2018-03-02 13:42:47 +01:00
Simon Giesecke
5d5def40b5 Problem: casts required due to void* arguments in a C++ class
Solution: introduce a type template argument
2018-03-02 13:42:42 +01:00
Simon Giesecke
5fb0e97ab7 Problem: semantic issues
Solution: added some TODO comments, improved existing documentation
2018-03-02 13:42:31 +01:00
Simon Giesecke
a9712c0bf2 Problem: no unittests for mtrie
Solution: made mtrie generic (to remove complex dependency on pipe_t),
and added some unit tests
2018-03-02 13:32:51 +01:00
Simon Giesecke
9fc3692e3f Problem: read-only arguments of mtrie are not declared as const
Solution: add const, introduce typedef
2018-03-02 13:32:50 +01:00
Romain Geissler
1e03f7b2d4 Fix gcc 8 build warning/error with -O3. 2018-02-27 10:12:22 +01:00
Pontus Sköldström
78aa9b1983 Support addressing TIPC Port Identity
ZeroMQ currently supports location independent addressing using TIPC
Port Names with tipc://{type,instance}. This commits adds support for
connecting and binding using TIPC Port Identity addresses. To connect
using Port Identities the expected format is tipc://<Z.C.N:Ref>, e.g.
"tipc://<1.2.3:123123>". To bind using TIPC Port Identities the expected
format is "tipc://<*>".
2018-02-19 17:34:40 +01:00
Kachanovskiy
e10464e45e Fix for build break when SIO_LOOPBACK_FAST_PATH is not defined (i.e. in VS2010) 2018-02-13 23:04:08 +01:00
Simon Giesecke
94743fd21f Problem: wrong formatting in several files
Solution: apply clang-format
2018-02-13 18:40:43 +01:00
Simon Giesecke
90c6d993be Problem: kqueue_t fails unittest_poller
Solution: fix shutdown of kqueue_t
2018-02-13 18:38:30 +01:00
Simon Giesecke
3b90ad8c63 Problem: support of std::atomic is incomplete in VS <2015
Solution: use std::atomic only from VS 2015
2018-02-13 18:38:29 +01:00
Simon Giesecke
96131b5b4e Problem: no documentation of the poller concept
Solution: added documentation
2018-02-13 18:38:25 +01:00
Simon Giesecke
a8e9032dc5 Problem: unreachable code in io_thread_t::process_stop
Solution: replaced by assertion
2018-02-13 18:38:24 +01:00
Simon Giesecke
a5738529e8 Problem: wsa_assert does not include error code
Solution: extend output of wsa_assert
2018-02-13 18:38:22 +01:00
Simon Giesecke
e8e24030ea Problem: network initialization and shutdown functions not available for
reuse

Solution: extract into functions defined in ip.hpp

Problem: signaler_t::make_fdpair not reusable

Solution: move make_fdpair to ip.hpp

Problem: epoll worker with no fds cannot be stopped

Solution: use interruptible epoll_pwait call

Problem: insufficient unit tests for poller

Solution: add test cases
2018-02-13 18:38:17 +01:00
Simon Giesecke
c62574ffca Problem: segfault in select_t::trigger_events
Solution: fixed access to stale vector
2018-02-12 14:42:46 +01:00
Simon Giesecke
11a5388637 Problem: data race w.r.t. select_t::stopping
Solution: change termination condition of select_t
2018-02-12 14:42:33 +01:00
Simon Giesecke
e650240580 Problem: data race w.r.t. poll_t::stopping
Solution: remove stopping, stop on thread-safe conditions; add
additional checks for correct thread-safe usage
2018-02-12 14:41:53 +01:00
Simon Giesecke
08201bc1b9 Problem: select blocks forever under Unix
Solution: fixed call of select, and initialization of poll_t members
2018-02-12 14:39:02 +01:00
Luca Boccassi
a30133d8f5
Merge pull request #2935 from ZMQers/unity-base
Problem: no test framework, no unit tests
2018-02-12 11:01:08 +00:00
Luca Boccassi
d0e01b4bb2 Problem: regression with "select" on *nix (#2940)
* Problem: build failure with select as polling mechanism

Solution: cast mailbox_handle argument to (poller_t::handle_t) like in
the reaper thread class.

* Problem: build failure due to INT_MAX use without include

Solution: include limits and climits in src/select.cpp where INT_MAX is
used

* Problem: build failure due to unused variable in select.cpp

Solution: move the declaration of int rc inside the ifdef block where
it is actually used

* Problem: reference to wrong variable in select.cpp breaks build

Solution: fix it

* Problem: family_entry_t constructor has no body, build fails on *nix

Solution: add empty inline function in the struct

* Problem: no test coverage for poll and select

Solution: add Travis jobs for them on Linux

* Problem: Travis jobs cannot run in container infra

Solution: set sudo: false as it is not required anymore
2018-02-12 03:01:03 -05:00
Simon Giesecke
7ea924c763 Problem: segfault on thread_t::stop if thread was never started
Solution: add started flag
2018-02-11 17:25:36 +00:00
Simon Giesecke
f87d3ab294 Problem: pollers unnecessarily depend on whole ctx_t, but actually use only start_thread method
Solution: extract thread_ctx_t from ctx_t
2018-02-11 17:25:36 +00:00
Simon Giesecke
5873894c83 Problem: wrong assertion macro used on Windows
Solution: use wsa_assert instead of errno_assert
2018-02-11 13:52:41 +01:00
Simon Giesecke
2f27bcd74b Problem: assertion failure in poll_t::poll if timer_event retired a
pollset entry

Solution: clean up retired entries before poll
2018-02-11 13:49:26 +01:00
Simon Giesecke
a2af3d18cc Problem: unittest_poller fails for poll_t
Solution: fixed behaviour in corner cases
2018-02-11 13:49:25 +01:00
Luca Boccassi
c33cb38af2
Merge pull request #2928 from eponsko/master
Add support for ZMQ_XPUB_NODROP on ZMQ_RADIO sockets
2018-02-09 17:15:47 +00:00
Pontus Sköldström
a57f7e3824 Add support for ZMQ_XPUB_NODROP on ZMQ_RADIO sockets
Solves issue #2927
2018-02-09 16:20:50 +01:00
Simon Giesecke
a5e763039d Problem: use of TCP loopback fastpath not available for user sockets
Solution: add socket option
2018-02-09 14:22:42 +01:00
sigiesec
490d76da2f Problem: SIO_LOOPBACK_FAST_PATH not activated for signaler socket pair
Solution: activate SIO_LOOPBACK_FAST_PATH if available

See #2899
2018-02-09 13:50:40 +01:00
sigiesec
88d8c768d1 Problem: test_timers frequently fails on travis-ci
Solution: relaxed test assertions, based on the actual time passed,
instead of assuming that this equals to the time slept
2018-02-09 09:55:40 +01:00
Simon Giesecke
3baefc66ea Problem: incomplete assertions around modifications of fd_entries vs.
load

Solution: add assertions, partially in debug build only, improved naming
2018-02-09 09:53:02 +01:00
Simon Giesecke
a1d55d0506 Problem: race conditions for options.linger (#2910)
* Problem: race conditions for options.linger

Solution: make options.linger atomic
2018-02-08 22:10:45 +00:00
Simon Giesecke
de0c669323 Problem: std::atomic not used on Visual C++ although it is available (#2930)
* Problem: std::atomic not used on Visual C++ although it is available

Solution: change conditional compilation to recognize _MSC_VER
2018-02-08 22:01:02 +00:00
Luca Boccassi
cdfc6bb8b3
Merge pull request #2924 from sigiesec/tcp-cleanup
Problem: duplicated code, redundant member handle_valid, asymmetry between tcp_connecter and tcp_listener
2018-02-08 21:57:46 +00:00
Luca Boccassi
9fbd125b41
Merge pull request #2917 from ZMQers/thread-safe-simplification
Problem: code duplication and unnecessary nesting around ZMQ_THREAD_SAFE querying
2018-02-08 21:57:06 +00:00
sigiesec
147fe9ed77 Problem: code duplication and unnecessary nesting around ZMQ_THREAD_SAFE
querying

Solution: remove code duplication and rearrange conditions
2018-02-08 22:54:30 +01:00
Luca Boccassi
cb9ccfa154
Merge pull request #2921 from sigiesec/mechanism-cleanup
Problem: code style issues in mechanism_t and socket_base_t
2018-02-08 21:53:14 +00:00