Commit Graph

3140 Commits

Author SHA1 Message Date
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
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
Simon Giesecke
3cb77e423e Use revision_pos constant 2018-08-09 12:47:18 +02:00
Simon Giesecke
758f903db4 Some code style improvements: removed redundant parentheses, added const, joined declaration and assignment of local variables 2018-08-09 12:41:08 +02:00
Simon Giesecke
89e5313114 Refactored zmq::stream_engine_t::handshake, extracted several sub-methods 2018-08-09 12:41:08 +02:00
Simon Giesecke
c3739ff604 Use static_cast instead of C-style casts, make local variables const where possible, use switch instead of chained if/else, extract rm_helper_multiple_subnodes from rm_helper to reduce nesting 2018-08-09 12:41:08 +02:00
Simon Giesecke
9e2cf35b66 Reduced number of calls to container end method 2018-08-09 12:41:08 +02:00
Simon Giesecke
19a70ab682 Optimized and simplified zmq::timers_t::execute and zmq::timers_t::timeout 2018-08-07 16:54:35 +02:00
Simon Giesecke
4f77cfa327 Removed unreachable code paths 2018-08-07 16:11:52 +02:00
Simon Giesecke
198c01e00b Use more structured for loop instead of while loop 2018-08-07 15:58:15 +02:00
Simon Giesecke
e4b4372c41 Simplified code 2018-08-07 14:15:35 +02:00
Simon Giesecke
ad3d1e7762 Reduced code duplication between xread and xhas_in 2018-08-07 14:15:35 +02:00
Simon Giesecke
3cca90ea44 Optimized zmq::dish_t::xhas_in 2018-08-07 14:15:35 +02:00
Simon Giesecke
aa1f5739b7 Optimized zmq::dish_t::xrecv 2018-08-07 14:15:35 +02:00
Simon Giesecke
fa976f87f9 Simplified uses of erase 2018-08-07 14:15:35 +02:00
Simon Giesecke
6357890ff6 Removed code duplication in process_commands 2018-08-07 10:17:12 +02:00
Luca Boccassi
3159161cef Problem: zmq_timers_* are ready for STABLE
Solution: move them from DRAFT state to STABLE
2018-07-27 23:07:56 +01:00
Michael Vilim
8a16fef3cc Problem: ZMQ_CONNECT_ROUTING_ID can be assigned to incoming socket connection (Issue #3191)
Solution: Add an identifier parameter for local attach to zmq::socket_base_t::attach_pipe
2018-07-26 18:26:35 -05:00
Alessio M
9066e0670f Problem: stack overflow on win64 #2876. Basically zmq::signaler_t::wait suffers from stack bloating the same way socket_poller was found to be bloated due to the large size of fd_set
Solution: replace the fd_set in the routine with an instance of optimized_fd_set_t
2018-06-28 14:11:32 +01:00
Luca Boccassi
b0d9a5a2d5
Merge pull request #3174 from ilue/master
Fix for issue #3162
2018-06-26 08:09:05 +01:00
Luca Boccassi
d70714e877 Problem: can't process ZMTP 3.1 cancel/subscribe commands
Solution: add some msg helpers to parse commands, and check for
subscribe or cancel commands and process them accordingly in the xpub
and xsub classes.
2018-06-23 17:16:10 +01:00
Luca Boccassi
8da4e9b95c Problem: pgm_sender does not initialise all its class variables
Solution: do it to silence static analysis warnings
2018-06-22 22:49:58 +01:00
ehilscher
0867c38032 Problem: connecter classes do not handle ZMQ_RECONNECT_IVL of -1 (#3163)
* Problem: connecter classes do not handle ZMQ_RECONNECT_IVL of -1

Solution: Add guards to prevent a reconnect timer from starting if ZMQ_RECONNECT_IVL is -1
(Issue 3158)
2018-06-12 23:23:39 +01:00
ilue
e22cd678b6
Fix #3162 2018-06-12 11:10:03 +08:00
Luca Boccassi
3a1e8f0704
Merge pull request #3159 from sigiesec/remove-superfluous-mutex
Problem: epoll_t employs an unnecessary mutex
2018-06-07 14:17:20 +01:00
Simon Giesecke
75e945f162 Problem: epoll_t employs an unnecessary mutex
Solution: remove the mutex
2018-06-06 21:41:16 +02:00
KIU Shueng Chuan
5a1ea0c398 Problem: ZMQ_USE_EPOLL_CLOEXEC not renamed to new name
Solution: rename it
2018-06-04 23:17:57 +08:00
pijyoi
c76ac5474b fix computation of winsock fd_set size (#3151)
* fix computation of winsock fd_set size
2018-06-02 13:16:33 +01:00
Simon Giesecke
5ac900a984 Problem: huge size of socket_poller_t object on Windows with select polling
Solution: use resizable_optimized_fd_set_t
2018-06-01 18:43:58 +02:00
Simon Giesecke
4a651251a7 Problem: code duplication within socket_poller_t
Solution: remove duplicated code
2018-06-01 18:24:42 +02:00
Simon Giesecke
74d3d8421f Problem: huge stack allocation with select on Windows in socket_poller_t::wait
Solution: use optimized_fd_set_t
2018-06-01 18:22:49 +02:00
Simon Giesecke
3d39bb9ca9 Problem: valid_pollset_bytes not reused in socket_poller
Solution: use it
2018-06-01 18:22:49 +02:00
Simon Giesecke
a8d62d14c1 Problem: polling utilities not at a reusable location
Solution: move to separate header
2018-06-01 18:22:48 +02:00
Simon Giesecke
7c0efcb588 Problem: huge stack allocation in Windows select code
Solution: use fast_vector_t as in poll implementation
2018-06-01 18:20:10 +02:00
Simon Giesecke
2533ffed86 Problem: memcpy code fragment is duplicated
Solution: unify between Windows and non-Windows code
2018-06-01 18:19:46 +02:00
Simon Giesecke
04dedfbc2a Problem: duplicated calculation of valid bytes in select pollset
Solution: extract to function
2018-06-01 18:16:46 +02:00
Simon Giesecke
e4c3297ed8 Problem: fragile handling of possibly dynamically allocated pollfds
Solution: extract class template fast_vector_t
2018-06-01 17:08:39 +02:00
Simon Giesecke
c6e4b0abb1 Problem: zmq_poll implementation is complex
Solution: extract compute_timeout method
2018-06-01 17:08:38 +02:00
Simon Giesecke
3db3bbfbbb Problem: duplication in implementation zmq_poller_poll
Solution: remove duplication
2018-06-01 17:08:38 +02:00
Simon Giesecke
4604014c12 Problem: unused result of call to pull_msg
Solution: add TODO comment regarding handling of the result
2018-05-31 11:21:33 +02:00
Simon Giesecke
c2ba553d87 Problem: unused values stored to variable, duplicated code
Solution: remove duplicated and redundant code
2018-05-31 11:02:26 +02:00
Simon Giesecke
ee4cdf8bf0 Problem: suspicious use of memcmp result
Solution: explicitly compare result against 0
2018-05-31 11:02:26 +02:00
Simon Giesecke
a2f91c5509 Problem: unnecessary passing of non-const data
Solution: make const
2018-05-30 23:21:53 +02:00
Simon Giesecke
c641644bb2 Problem: inconsistent parameter names
Solution: harmonize
2018-05-30 23:21:52 +02:00
Simon Giesecke
9e6f1c9a3c Problem: redundant else after return
Solution: remove redundant else
2018-05-30 23:21:52 +02:00
Simon Giesecke
6fa12bd692 Problem: unused stored value warning
Solution: add LIBZMQ_UNUSED
2018-05-30 23:21:52 +02:00
Simon Giesecke
0f2979a38e Problem: assignment used as condition warning
Solution: changed condition
2018-05-30 23:21:52 +02:00
Simon Giesecke
24edc828ab Problem: redundant else after return
Solution: remove redundant else
2018-05-30 23:21:52 +02:00
Simon Giesecke
88646438d2 Problem: differing parameter names between declaration and definition
Solution: harmonize
2018-05-30 23:21:52 +02:00
Simon Giesecke
da4309da13 Problem: violation of parameter naming conventions
Solution: change to comply with naming conventions
2018-05-30 23:21:52 +02:00
Simon Giesecke
29f1f39df3 Problem: unused parameter warning
Solution: mark parameter as unused depending on platform definitions
2018-05-30 23:21:52 +02:00
Simon Giesecke
b59d7d574d Problem: typo in parameter name
Solution: correct spelling
2018-05-30 22:52:19 +02:00
Simon Giesecke
a91c7e718c Problem: warnings on violations of CERT ERR-58
Solution: declare functions noexcept
2018-05-30 22:52:19 +02:00
Simon Giesecke
93194e7c53 Problem: non-portable memset
Solution: add dummy pointer meber to union instead
2018-05-30 22:50:30 +02:00
Simon Giesecke
9c8fde09ca Problem: inconsistent control structures in address.cpp, redundant check for NULLness before delete
Solution: harmonize, remove redundant checks
2018-05-30 22:50:30 +02:00
Simon Giesecke
0179b7577a Problem: literals protocol names used at various places
Solution: introduced named constants
2018-05-30 22:50:29 +02:00
Simon Giesecke
bd76926f5b Problem: code style issues in options_t (C-style cast, suboptimal std::string::find call, redundant method is_valid)
Solution: resolved these issues
2018-05-30 13:13:31 +02:00
Simon Giesecke
a96a87f343 Problem: problematic atoi function is used (CERT ERR-34C)
Solution: use strtol instead
2018-05-30 10:35:01 +02:00
Simon Giesecke
273137741a Problem: protected data members in ip_address_t, ip_address_mask_t violates LSP
Solution: make ip_address_mask_t independent of ip_address_t, they do not share that much, remove some code duplication between ip_address_t and ip_addr_t
2018-05-30 10:28:14 +02:00
Simon Giesecke
314ac28dbd Problem: protected data member in ip_resolver_t
Solution: declare private
2018-05-30 10:03:55 +02:00
Simon Giesecke
573815da83 Problem: protected data member in encoder_base_t
Solution: encapsulate data member properly
2018-05-30 09:57:46 +02:00
Simon Giesecke
be8e7de6be Problem: temporary files in repo
Solution: remove them
2018-05-30 09:30:00 +02:00
Simon Giesecke
5a343fc27b Problem: stream_t/router_t access data member of base class
Solution: pull up functionality to base class
2018-05-29 15:05:27 +02:00
Simon Giesecke
ab3895a470 Problem: duplicated code in stream_t & router_t
Solution: pulled up to routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
09fab930b3 Problem: xwrite_activated duplicated between stream_t and router_t
Solution: pull up into routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
c9d6ef3035 Problem: Member outpipes is duplicate between router_t and stream_t
Solution: extract into common base class routing_socket_base_t, for now as protected
2018-05-29 15:05:26 +02:00
Simon Giesecke
728eddfcfd Problem: socket_base_t::connect_routing_id is protected and only used in router_t and stream_t
Solution: add an intermediary base class routing_socket_base_t, move common functionality there and make connect_routing_id private
2018-05-29 15:05:26 +02:00
Simon Giesecke
25461a78dd Problem: members of mechanmism_t are needlessly protected
Solution: make them private
2018-05-29 11:08:22 +02:00
Simon Giesecke
47dcd84f21 Problem: C-style casts
Solution: replace by reinterpret_casts or avoid entirely
2018-05-28 18:47:07 +02:00
Simon Giesecke
917a4a8e10 Problem: reinterpret_casts between unsigned char* and char*
Solution: use char* from the beginning
2018-05-28 18:47:07 +02:00
Simon Giesecke
0a43c66a32 Problem: magic literals in zap_client.cpp
Solution: extracted constants
2018-05-28 18:47:07 +02:00
Simon Giesecke
7c2d1c1824 Problem: magic literals for UCHAR_MAX
Solution: use UCHAR_MAX constant instead
2018-05-28 18:46:50 +02:00
Simon Giesecke
a4c817e736 Problem: magic number "2" in socket_base.cpp
Solution: calculate from field sizes
2018-05-28 18:45:41 +02:00
Simon Giesecke
d75ec5e055 Problem: produce_* functions always return 0
Solution: change return type to void, and remove redundant result checks
2018-05-28 17:53:46 +02:00
Simon Giesecke
7f880c256f Problem: magic numbers and data duplication in plain_*.cpp
Solution: extract constants / move to plain_common.hpp
2018-05-28 17:53:46 +02:00
Simon Giesecke
8269b23e56 Problem: magic numbers and code duplication in msg.cpp
Solution: extract constants and unified cases
2018-05-28 17:53:44 +02:00
Simon Giesecke
18000a213f Problem: magic numbers in mechanism_base.cpp
Solution: extract constants
2018-05-28 17:53:44 +02:00
Simon Giesecke
abca9f6bc1 Problem: Magic numbers in plain_server.cpp
Solution: introduced constants
2018-05-28 17:53:44 +02:00
Simon Giesecke
2da6629e0f Problem: Magic numbers "1" and "100" in signaler.cpp
Solution: introduced constants, use std::min/std::max instead of control structures
2018-05-28 17:53:43 +02:00
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