Commit Graph

3106 Commits

Author SHA1 Message Date
Simon Giesecke
f60f909899 Problem: missing use of C++11 = delete and = default
Solution: introduce macros ZMQ_DEFAULT and ZMQ_NON_COPYABLE_NOR_MOVABLE
2019-12-09 09:48:21 +01:00
Simon Giesecke
86d7de38ca Problem: redundant empty destructor
Solution: Remove definition
2019-12-08 19:43:31 +01:00
Simon Giesecke
f8adf9ea55 Problem: unnecessary value parameters
Solution: change to const references
2019-12-08 15:24:48 +01:00
Simon Giesecke
cb2b377d9f Problem: redundant else after return
Solution: remove else
2019-12-08 15:24:48 +01:00
Simon Giesecke
fdabd73da6 Problem: parameters not const where const possible
Solution: add const
2019-12-08 15:24:48 +01:00
Simon Giesecke
84267e734b Problem: inconsistent parameter names on definition/declaration
Solution: align them
2019-12-08 15:24:48 +01:00
Simon Giesecke
cd954e207d Problem: use of C-style casts
Solution: use static_cast/reinterpret_cast instead
2019-12-08 15:24:48 +01:00
Simon Giesecke
a83c57d0bb Problem: identifiers not conformant with naming convention
Solution: fix identifier names
2019-12-08 15:24:48 +01:00
Luca Boccassi
df993d113c
Merge pull request #3751 from sigiesec/windows-domain-sockets-signaler
Use Unix domain sockets for listener when available on Windows
2019-12-07 00:25:21 +00:00
Simon Giesecke
ca552d563f Problem: listener socket uses TCP loopback connections which sometimes go awry
Solution: Use domain sockets instead if available
2019-12-06 19:11:50 +01:00
Simon Giesecke
bd4c2d60ba Problem: zmq::listener_t::create_wildcard_address not reusable in ip.cpp
Solution: move to ip.hpp as zmq::create_ipc_wildcard_address
2019-12-06 19:11:50 +01:00
Simon Giesecke
3bcaea535c Problem: zmq_fdpair function is very long
Solution: Extract TCP/IP loopback variant into zmq_fdpair_tcpip
2019-12-06 17:51:13 +01:00
liedtkeInTUM
65d2f1f498 Problem: if IPC enabled libzmq does not compile when in uwp build (#3747)
* Problem: if IPC enabled libzmq does not compile when in uwp build

* Problem 10.0.##### can be valid windows target versions

* Problem: No builds are triggered on uwp platform

* Problem: epoll is set before UWP platform is checked

* Problem: used wrong CMAKE_SYSTEM_NAME specifier

* Problem: build tests fails during cmake configure

* Use Win32 build step for Win32-uwp platform

* Disable compile options that produce warnings that leads to a ci fail

* winnt version is set by cmake, no need for redefinition in windows.hpp

* Eliminate all warning according Incremental and opt:icf are specified

* Prefer to disable opt flags in debug config rather than incremental linking

* CMAKE_GENERATOR should not include uwp definition

* Add release build with uwp configuration

* Problem: pointer potentially uninitialized
2019-12-06 13:27:24 +00:00
Andrij Abyzov
5a854780f2 Problem: cannot send arbitrary data from XSUB to XPUB.
Solution: now if the first frame in a multipart message is not subscribe/unsubscribe,
the rest of the parts are also considered to be not subscribe/unsubscribe.
2019-12-04 16:25:08 +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
Luca Boccassi
c711941e9a Problem: wildcard port binding does not work with WS sockets
Solution: remove the path from the address when resolving
2019-11-28 09:27:05 +00:00
Luca Boccassi
79d75f017c Problem: WS sockets return TCP protocol strings with ZMQ_LAST_ENDPOINT
Solution: use the correct address class when resolving
2019-11-28 09:27:05 +00:00
Andrij Abyzov
04761133bf Fix zmq::select_t::loop formatting 2019-11-20 09:29:59 +01:00
Andrij Abyzov
108977c838 Change XSUB -> XPUB multipart message processing.
Now only the first part in a multipart message will be treated as subscribe/unsubscribe.
The rest will be considered user messages regardless of the first byte.
2019-11-19 18:22:12 +01:00
Luca Boccassi
9ced36e407 Problem: WSAEventSelect checks for FD_OOB, but select does not
WSAEventSelect is used on Windows (when select is the polling method)
only if waiting for more than one socket family, excluding IPv4/6.
It is then passed FD_OOB, which means it can be woken by OOB messages,
but select later on never checks for it.
Remove FD_OOB as it's not actually used for anything.
2019-11-01 09:34:03 +00:00
Simon Giesecke
302436515c Problem: windows socket error number cleared before saved to saved_errno
Solution: call tune_socket only if connect was successful
2019-10-29 23:04:54 +01:00
Simon Giesecke
66d0f3511f Problem: ipc transport not supported under Windows
Solution: implement support
2019-10-29 23:04:54 +01:00
Simon Giesecke
7f43e7ff75 Problem: build targeting Windows XP is broken
Solution: fix build issues
2019-10-19 14:04:55 +02:00
Michele Dionisio
9f65720dc0 Revert "Problem: pkg-config file cannot be used for static linking on CentOS 7"
This reverts commit 765c24740d.
2019-10-14 20:43:33 +02:00
Luca Boccassi
683bf1d732
Merge pull request #3713 from mdionisio/useless_ceil
avoid to use std::ceil
2019-10-14 15:53:39 +01:00
Michele Dionisio
f07f47b1e3 avoid to use ceil function
ceil function is usually in math library that can be avoided as dependency
2019-10-14 16:18:27 +02:00
Chih-Hsuan Yen
765c24740d
Problem: pkg-config file cannot be used for static linking on CentOS 7
Solution: add -lm to Libs.private of libzmq.pc so that the std::ceil
usage in src/decoder_allocators.cpp is satisfied during static linking
on CentOS 7.

See https://github.com/zeromq/libzmq/issues/3710 for a reproducer.
2019-10-12 22:36:31 +08:00
somdoron
9b15658eb1 problem: zero-sized messages cause assertion when glibc assertion are on
Solution: when a zero-sized message is encoded or decoded avoid mem copy
2019-10-07 09:11:44 +03:00
somdoron
618227f63c problem: GNUTLS handshake is getting blocked because of timeout on some versions
Solution: disable handshake timeout
2019-10-06 11:05:56 +03:00
somdoron
a9bb526403 problem: wss transport return incorrect return code for error
Solution: return -1 for errors
2019-10-04 20:46:00 +03:00
somdoron
2018be643a problem: valgrind complain about uninitialized value
Solution: initialize the value
2019-10-04 17:13:48 +03:00
somdoron
977f137a83 problem: cannot check WS and WSS capability
Solution: add capability check to zmq_has
2019-10-04 16:27:36 +03:00
somdoron
41b9af2c79 problem: WS transport doesn't support mechanism
Solution: add support to mechanism
2019-10-04 16:24:48 +03: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
trya
2fe9dd9101 Problem: ZMQ_CONFLATE on PUB sockets delivers to only one subscriber at most
Solution: Fix behavior of dbuffer on writes. Message passed in argument
of dbuffer::write can be assigned directly to the back buffer without
leaking, since the message has already the right reference count (see
dist::distribute and msg_t::add_refs). Secondly, in order to prevent the
message pending in the front buffer from leaking if it hasn't been
closed yet (for example because the peer is not reachable anymore), move
back buffer to front buffer using msg_t::move instead of swapping the
buffers, thus allowing release of the message in the front buffer.
2019-09-24 02:57:24 +02: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
52e0d965b3 problem: ws_engine doesn't check Sec-WebSocket-Protocol
Solution: Validate Sec-WebSocket-Protocol and make sure ZWS2.0 is one of the protocols
2019-09-05 23:11:29 +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
6fb8ef0711 Problem: can no longer send user data from XSUB to XPUB
Solution: fix regression introduced by:
https://github.com/zeromq/libzmq/pull/3168

Correctly fall back to user message if the first byte is neither 0 nor
1, and add a simple unit test

Fixes https://github.com/zeromq/libzmq/issues/3656
2019-09-02 11:33:19 +01:00
Francesco Montorsi
b3582da8fb Introduce extended set/get methods for ZMQ contexts (#3642)
* Introduce DRAFT zmq_ctx_set_ext() and zmq_ctx_get_ext() methods. Change
ZMQ_THREAD_NAME_PREFIX to allow for non-numeric thread name prefixes.
2019-08-27 23:41:23 +01:00
Andrei Tomashpolskiy
2aa87c94cc UDP engine aborts on networking-related errors from socket syscalls (2) #2862 (#3640)
* UDP engine aborts on networking-related errors from socket syscalls #2862
2019-08-25 15:55:42 +01:00
Andrei Tomashpolskiy
f48c86d077 UDP engine aborts on networking-related errors from socket syscalls #2862 (#3638)
* UDP engine aborts on networking-related errors from socket syscalls #2862

* Add relicense statement
2019-08-22 18:52:31 +01:00
Luca Boccassi
9bb197e030
Merge pull request #3613 from TomzBench/mingw-fix
no void pointer to store function pointer
2019-08-19 11:15:29 +01:00
Simon Giesecke
e9b67001dd
Problem: invalid syntax for calling convention on function pointer
Solution: fix syntax and formatting, remove C-ism for defining struct
2019-08-19 10:13:11 +02:00
Luca Boccassi
87988bf4c8 Problem: formatting error
Solution: run make clang-format-diff to fix it
2019-08-11 12:00:13 +01:00
thomas
64d58c432c relicense add 2019-08-10 11:15:26 -04:00
thomas
87b81926aa no void pointer to store function pointer 2019-08-10 10:43:28 -04:00
Christopher Hall
72854e6342 problem: DragonFly BSD does not allow mapping global IPv4 addresses when IPv6 is used
solution: Handle as for OpenBSD by not attemption to set this option on the socket

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
2019-08-06 12:11:06 +08:00
Luca Boccassi
4d5e97adac Problem: formatting errors introduced by #3601
Solution: fix them with make clang-format-diff
2019-07-30 13:43:48 +01:00
Jacques Germishuys
b3123a2fd1 Problem: __try and __except isn't universally supported on windows
Solution: Manually push/pop an exception registration record.
Only set the thread name with a debugger present
2019-07-30 11:31:22 +01:00
Shubham Lagwankar
f07d88be09 Problem: redundant check in condition
Solution: remove it
2019-07-26 11:43:57 -04:00
aixxe
63409579e7
Problem: Usage of 'if_nametoindex' not supported in Windows XP.
Solution: Add ZMQ_HAVE_WINDOWS_TARGET_XP check to src/udp_address.cpp.
2019-07-25 20:38:54 +01:00
Mancaș George
13387c5cdc Problem: stream_engine use after free
Solution: Don't allow concurrent heartbeat timers
2019-07-24 13:04:32 +00: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
7262701876 Problem: build on centos6/ubuntu12 still broken
Solution: move the definition of __STDC_LIMIT_MACROS somewhere the test actually uses
2019-07-16 18:15:47 +01:00
Luca Boccassi
496c8eb05a Problem: missing copyright and license header from new file
Solution: add it
2019-07-16 17:37:40 +01:00
Luca Boccassi
10a0baf691 Problem: wrong copyright dates in newly added files
Solution: fix them
2019-07-16 17:36:44 +01:00
Luca Boccassi
38c31154d0 Problem: build broken with older compilers
Solution: define __STDC_LIMIT_MACROS before including stdint.h so that SIZE_MAX
is defined
2019-07-16 17:34:58 +01: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
1781cff37b Problem: plaintext secrets placed in insecure memory
Solution: Use secure_allocator_t for plaintext secrets
2019-07-14 17:12:39 +02: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
Doron Somech
9c5cf8573c
Merge pull request #3573 from sigiesec/use-std-vector
Problem: use of malloc is error-prone
2019-07-10 20:07:33 +03:00
Simon Giesecke
1de4cf6ffa Problem: use of malloc is error-prone
Solution: use std::vector instead, simplify control-flow
2019-07-10 18:26:58 +02:00
Luca Boccassi
c819eedd89 Problem: missing rc checks in udp_engine
Solution: add them
2019-07-09 17:25:58 +01:00
Thomas M. DuBuisson
90ff30c086 Free memory when curve_client sends invalid ready message. 2019-07-08 21:05:36 -07:00
Luca Boccassi
8e6bafcbe0 Problem: application metadata not parsed correctly when using CURVE
Solution: create buffers large enough to contain arbitrary metadata
2019-07-08 10:47:27 +01:00
Luca Boccassi
ddd0da2f57
Merge pull request #3476 from TomMD/fix/memory-leak
Request handling leaked memory.  Depending on the application's use o…
2019-07-06 10:05:25 +01:00
Thomas M. DuBuisson
367cedb7c6 Fix request-handling memory leak 2019-07-05 16:53:46 -07:00
Shubham Lagwankar
1186e9868a Problem: code doesn't follow libzmq naming conventions
Solution: rename types/variables that are inconsistent
2019-06-28 11:57:45 -04:00
Luca Boccassi
a43c842e0d
Merge pull request #3556 from ssbl/better-names
Problem: variable and type names are not descriptive
2019-06-27 18:23:19 +01:00
Shubham Lagwankar
d1e6fe19b4 Problem: variable and type names are not descriptive
Solution: use more descriptive names

This commit also improves comments related to some of the changes.
2019-06-27 11:57:01 -04:00
jean-airoldie
cfcab66c71 Problem: {in,out}_batch_size must be configured at compiled time
Solution: Added a socket option to configure them at runtime.
2019-06-27 02:31:11 -04:00
Shubham Lagwankar
15dafb1c1c Problem: radix tree's apply function uses incorrect resizing logic (#3548)
* Problem: radix tree's apply function uses incorrect resizing logic

Solution: rewrite the function using a vector

The buffer is extended once by 256 bytes, which will not be enough if
the node holds data larger than this number.
2019-06-20 07:58:08 +01:00
Luca Boccassi
3c06ec118f Problem: formatting errors
Solution: apply clang-format-diff
2019-06-11 10:31:15 +01:00
Philippe Bernardino Leite
8a02f70706
pthread_equal to compare thread ids
I am trying to port ZeroMQ to z/OS USS and I faced several problems. One of them is this function "is_current_thread" trying to compare two thread ids with operator "==". I've changed the code to use the official function "pthread_equal" to compare thread ids and now it's working fine.
2019-06-10 22:10:01 -03:00
Christophe Guillon
58c30dc7d1 Add support for SOCKS5 basic authentication 2019-06-10 16:40:06 +02:00
Christophe Guillon
42cfa697f2 Fix issues with SOCKS5 proxy connection
Two issues where introduced by commit 12c4b55a:
- the proxy connection was done to the target address instead of
the proxy address
- on error the proxy connection status was not reset to unplugged
2019-06-10 14:32:20 +02:00
Romain Moret
5b07a1199c Fix compiler error 2019-05-21 15:07:00 +02:00
Romain Moret
27005cc1ae Implement thread name on windows, cleanup thread naming internals 2019-05-21 12:12:19 +02:00
Doron Somech
046ccfc408
Merge pull request #3513 from bluca/clang7
Problem: clang-format 5 has issues with comments
2019-05-18 19:18:42 +03:00
Luca Boccassi
bde18f3ede Problem: comments before ifdefs are wrongly formatted
Solution: now that clang-format 6+ is used in the CI, fix it
2019-05-18 17:09:17 +01:00
Luca Boccassi
19ff4d0b6a Problem: zmq_socket_monitor_versioned_typed duplicates zmq_socket_monitor_versioned
Solution: unify the two APIs, as they are both still in DRAFT state and
thus can be changed.
2019-05-18 16:44:07 +01:00
Luca Boccassi
41be0f5386 Problem: new xpub option is in critical path
Solution: use unlikely to optimize for the most common case
2019-05-18 16:44:07 +01:00
Luca Boccassi
a53dfe936a Problem: many unnecessary ifdefs covering new xpub option
Solution: remove them, only public headers have to be ifdef'd
2019-05-18 16:44:07 +01:00
imkcy9
2f98f7034b Support XPub socket send last value caching to last subscription pipe with ZMQ_XPUB_MANUAL_LAST_VALUE. (#3511)
* Add ZMQ_XPUB_MANUAL_LAST_VALUE

* Surpport xpub send last value caching to one pipe with ZMQ_XPUB_MANUAL_LAST_VALUE

* Add test_xpubub_manual_last_value

* Add relicense and doc
2019-05-17 22:12:32 +01:00
jean-airoldie
606a8f7967 Problem: Socket monitoring only allows ZMQ_PAIR
Solution: Allow ZMQ_PUB and ZMQ_PUSH sockets types for the monitoring.
This way someone could create a ZMQ_PULL socket connected to multiple
monitoring sockets at the same time.
2019-05-15 01:48:46 -04:00
Simon Giesecke
6e1c58e86e Problem: PLAIN HELLO message incorrectly uses WELCOME literal
Solution: change to HELLO
2019-05-10 03:55:07 -04:00
Simon Giesecke
d46c580977 Problem: signature of zmq_poller_fd does is incompatible with regular error handling
Solution: change return type to int (again) and return fd via an output parameter
2019-05-09 11:09:35 -04:00
Simon Giesecke
63c4d8be78 Problem: syntax error on Windows related to socket descriptor type
Solution: use proper fd_t type, and also define and use a zmq_fd_t in the API
2019-05-09 07:21:08 -04:00
jean-airoldie
cdbe120738 Problem: No invalid pointer handling for zmq_poller_fd
Solution: Add some and document it.
2019-05-02 17:10:20 -04:00
jean-airoldie
046534480b Problem: Cannot get thread safe socket fd
Solution: Add a method to get the zmq_poller's signaler fd. Then we can
associate a poller instance with every thread safe socket and use its
fd.
2019-04-27 22:58:42 -04:00
Shubham Lagwankar
e9678efe00 Problem: unused Windows-specific code in sleep_ms
Solution: remove it since sleep_ms isn't used on Windows
2019-04-24 14:39:27 -04:00
Rosen Penev
091e15a28d
Add <ios> include to fix uClibc++ compilation
Under uClibc++, streamoff is defined in <ios>. This header is needed to fix compilation.
2019-04-19 12:16:01 -07:00
Luca Boccassi
3c21eed0a1 Problem: CI format check fails
Solution: fix it
2019-04-06 00:12:32 +01:00
Serhio
db7bdd1b1a Some explicit endpoint type changes to support GCC 5 (#3468)
* Some explicit endpoint type changes to support GCC 5

* ../RELICENSE/SergheiNovac.md
2019-04-05 10:54:26 +01:00
Simon Giesecke
42e27b7d0d Problem: socket returned by ZMQ_FD cannot be used with CreateIoCompletionPort
Solution: add WSA_FLAG_OVERLAPPED socket flag
2019-03-27 09:56:11 +01:00
Simon Giesecke
47dba21005 Problem: code is unnecessarily imperative
Solution: make more functional-style
2019-03-24 13:46:15 -04:00
Simon Giesecke
1450830611 Problem: unused include directives
Solution: remove and add where needed
2019-03-23 09:46:37 -04:00
Simon Giesecke
2f40d21618 Problem: access to moved object
Solution: use move target instead
2019-03-22 12:06:12 -04:00
Simon Giesecke
e17232f725 Problem: possible use-after-free
Solution: check for failure and do not access any members afterwards
2019-03-22 12:06:12 -04:00
Luca Boccassi
17c47da01c
Merge pull request #3452 from jacquesg/strnlen
Problem: strnlen may not be available
2019-03-18 12:09:38 +00:00
Jacques Germishuys
b26542bbfc Problem: strnlen may not be available
Solution: Provide an implementation
2019-03-18 11:37:53 +00:00
Jacques Germishuys
8a2296711d Problem: epoll_t no longer requires _worker
Solution: Remove _worker
2019-03-18 10:16:13 +00:00
Jacques Germishuys
212ab4f834 Problem: /dev/poll doesn't compile
Solution: Make devpoll_t derive from worker_poller_base_t
2019-03-18 10:15:27 +00:00
Claudio Biagi
d41ed6180b Proxy performance fix, ticket #3439
Improve performance of the proxy forwarding batch of message.
Add throughput benchmark for proxy.
Fix valgrind error reported on unitialized vars
RELICENSE: Add emtr grant
2019-03-08 15:02:58 +01:00
Simon Giesecke
36d265ee7d Problem: redundant parentheses in return statements
Solution: remove them
2019-03-01 05:46:10 -05:00
Simon Giesecke
0c363fbb76 Problem: argument is unnecessarily copied
Solution: move instead
2019-03-01 05:46:10 -05:00
Simon Giesecke
d61d662ecb Problem: reconnect interval exponential backoff and may lead to integer overflows
Solution: guard calculation against integer overflows
2019-02-27 08:50:01 -05:00
Eelis van der Weegen
8259c519b3 Problem: Program crashes if memory allocation in socket_poller_t::rebuild fails.
Solution: Report memory allocation failure as ENOMEM so applications can handle it gracefully.

Fixes #3427.
2019-02-23 09:55:04 +01:00
Luca Boccassi
f83b13b2d6 Problem: build fails on VS2010 as it does not have snprintf
Solution: ifdef it
2019-02-17 20:15:59 +00:00
Luca Boccassi
c63b0955e5 Problem: zmq_threadstart name not distinguished
Solution: name it ZMQapp instead of ZMQbg, as it's created by the
application
2019-02-17 20:15:59 +00:00
Luca Boccassi
c8d039a3c7 Problem: unused variable warning in thread_start on !Linux
Solution: use LIBZMQ_UNUSED
2019-02-17 20:15:59 +00:00
Luca Boccassi
f7ca7515d7 Problem: new thread parameter not initialised in ctor
Solution: do it and remove ifndef windows
2019-02-17 20:15:59 +00:00
Luca Boccassi
d02561eec0 Problem: IO thread name starts counting at 1
Solution: start at 0
2019-02-17 20:15:59 +00:00
Luca Boccassi
563396445a Problem: IO thread name uses space separator, the rest uses /
Solution: use / like the rest of the names
2019-02-17 20:15:59 +00:00
Luca Boccassi
de76789ac6 Problem: new thread naming breaks build on !Linux and overwrites prefix
Solution: use the thread class function rather than one of the pthread
functions, and take into account the thread prefix context option
2019-02-17 20:15:59 +00:00
Kymeta Corp
484374f2b6 Problem: Threads don't have names which complicates debugging.
Solution:
1. Use optional name parameter in thread_t::start for operating
systems that have thread names.
2. Give start_thread() an optional name parameter for the
thread's name. If this parameter is set, it will be appended to "0MQ:".
If not set, "0MQ" will be used as the thread's name.
3. Give epoll the ability to name its thread. Then use this in
io_thread and reaper to name them.
2019-02-17 20:15:33 +00:00
Simon Giesecke
7fbd977184 Problem: assertion triggered in stream_connecter_base::close
Solution: change into regular control flow condition
2019-02-12 03:47:26 -05:00
Simon Giesecke
2759f459df Problem: C4267 warnings due to implicit conversion from size_t to int
Solution: change variable type to size_t
2019-02-12 03:47:26 -05:00
Simon Giesecke
120edd9809 Problem: selection of condition_variable_t implementation is confusing and not configurable
Solution: move configuration to build definition
2019-02-12 03:47:26 -05:00
Simon Giesecke
d7e1cf3eb0 Problem: std::condition_variable can only be used with std::unique_lock<std::mutex>, leading to two mutexes used in condition_variable_t
Solution: use std::condition_variable_any instead
2019-02-11 07:12:43 -05:00
Luca Boccassi
feadf6d40f Problem: cannot monitor state of queues at runtime
Solution: add API and ZMQ_EVENT_PIPES_STATS event which generates 2
values, one for the egress and one for the ingress pipes respectively.
Refactor the events code to be able to send multiple values.
2019-02-10 16:33:26 +00:00
Luca Boccassi
cb73745250 Problem: cannot send more than one value per v2 event
Solution: refactor code and add extra frame with value count before the
values in v2
2019-02-07 20:42:47 +00:00
Simon Giesecke
9cb1fca115 Problem: on a failure to setsockopt SO_BINDTODEVICE, libzmq asserts
Solution: return an error to the user instead
2019-02-07 09:39:02 -05:00
Simon Giesecke
a763d734f2 Problem: formatting broken
Solution: run clang-format
2019-02-07 11:44:18 +01:00
Simon Giesecke
7cf0d125d3 Problem: failed address resolution on TCP connect is not observable
Solution: added TODO comment for now
2019-02-07 11:07:37 +01:00
Simon Giesecke
e45ede49b5 Problem: regression introduced by 68d520e, changing behaviour of unblocking sockets
Solution: move unblock call to original location
2019-02-07 11:04:05 +01:00
Simon Giesecke
84dc40dd90 Problem: regression introduced by 68d520e, leading to tcp name resolution no longer working
Solution: restore "local" flag values in call to resolve

Fixes #3394
2019-02-07 11:03:51 +01:00
Luca Boccassi
5ecf8f93e2
Merge pull request #3395 from somdoron/ZeroCond
Problem: invoking the conditional variable for zero time is expensive
2019-02-06 22:08:16 +00:00
somdoron
462dd36d0e Problem: invoking the conditional variable for zero time is expensive
Solution: for zero timeout, unlock and relock immediately instead of timedwait
2019-02-06 21:07:53 +02:00
Simon Giesecke
b54b55d854 Problem: sun_path in an AF_UNIX address might not be null-terminated
Solution: use addrlen to determine the length
2019-02-06 07:18:28 -05:00
Simon Giesecke
31015fdcfe Problem: ipc_address data member does not conform with naming convention
Solution: rename data member
2019-02-06 07:12:21 -05:00
Simon Giesecke
808028fe02 Problem: use of unnecessary complex stringstream
Solution: use memcpy instead
2019-02-06 07:11:10 -05:00
Luca Boccassi
2df988eec3 Problem: build broken with newer gcc
Solution: add missing includes to stream_listener_base
2019-02-05 18:57:33 +00:00
Simon Giesecke
8d784f26ab Problem: close always fails with wildcard bind, since directory is not empty
Solution: unlink the socket file first
2019-02-05 10:17:28 -05:00
Luca Boccassi
b14bb2d8f8
Merge pull request #3388 from sigiesec/add-missing-include
Problem: missing include directive for close/closesocket
2019-02-05 14:24:16 +00:00
Simon Giesecke
ded4ff6fd2 Problem: missing include directive for close/closesocket
Solution: add appropriate includes
2019-02-05 09:21:06 -05:00
Luca Boccassi
b8b1b8def3
Merge pull request #3384 from sigiesec/remove-socks-tcp-code-duplication
Remove socks/tcp code duplication
2019-02-05 13:19:54 +00:00
Simon Giesecke
74d62bb908 Problem: tcp address strings are dependent on locale
Solution: use sprintf instead of std::stringstream
Fixes #3385
2019-02-05 05:45:35 -05:00
Simon Giesecke
e583276380 Problem: unnecessary platform-specific code parts around socklen_t
Solution: use zmq_socklen_t
2019-02-05 03:34:32 -05:00
Simon Giesecke
c215235fb2 Problem: redundant string operations in zmq::udp_engine_t::sockaddr_to_msg
Solution: reuse string lengths and use memcpy instead
2019-02-05 03:34:32 -05:00
Simon Giesecke
d451a95234 Problem: redundant code in different preprocessor branches
Solution: change preprocessor guard scope
2019-02-05 03:34:32 -05:00
Simon Giesecke
fc6ef0ebff Problem: zmq::get_peer_ip_address duplicates code from get_socket_address
Solution: change to use get_socket_address
2019-02-05 03:34:32 -05:00
Simon Giesecke
2f7a450294 Problem: socks_connecter_t duplicates code around opening and configuring a TCP socket
Solution: use tcp_open_socket function
2019-02-05 03:34:32 -05:00
Simon Giesecke
68d520ef68 Problem: tcp_connecter_t and tcp_listener_t duplicate code around opening and configuring a TCP socket
Solution: extract common parts into tcp_open_socket function
2019-02-05 03:34:32 -05:00
Simon Giesecke
3f4e64edc0 Problem: bind_to_device unnecessarily accepts a non-const string parameter
Solution: add const
2019-02-04 09:29:42 -05:00
Simon Giesecke
12c4b55af8 Problem: socks_connecter_t duplicates code with stream_connecter_base_t
Solution: let socks_connecter_t derive from stream_connecter_base_t and remove duplicate code
2019-02-04 09:29:42 -05:00
Luca Boccassi
0411bc159a Problem: tipc disconnect does not work anymore
Solution: change back the indentifier endpoint to the one passed by the
user rather than the resolved one, otherwise when the user passes the
same string to the disconnect call they do not match anymore
2019-02-03 23:01:20 +01:00
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