Commit Graph

2168 Commits

Author SHA1 Message Date
Doron Somech
c41d514b8b Revert "problem:Socket try to access closed mutex" 2016-05-10 16:23:29 +03:00
Doron Somech
77d3d7b4dc problem:Socket try to access closed mutex 2016-05-10 13:49:57 +03:00
hitstergtd
124ebd2dd6 Problem: UDP engine code not indented properly
Solution:
Indent it.
2016-05-08 18:30:17 +01:00
KIU Shueng Chuan
bb4bcf8f45 fix: sockets are not signed int on Windows 2016-05-08 16:29:15 +08:00
Luca Boccassi
8045e9ae24 Problem: no backtrace is printed on assert
Solution: add an optional dependency on libunwind, and if present
use it to print the backtrace when zmq_abort is called.
2016-05-06 21:34:25 +01:00
Luca Boccassi
17132f0387 Problem: read-after-free when closing socket
Solution: use socket object's mutex before the send_reap() call that
might deallocate it
2016-05-05 17:47:16 +01:00
Constantin Rack
5dadded0a1 Merge pull request #1961 from somdoron/Signaler
problem: closed poller still associated with socket
2016-05-05 12:57:24 +02:00
Doron Somech
a747f72450 problem:closed poller still associated with socket 2016-05-05 13:50:33 +03:00
hitstergtd
109122dd46 Problem: style issues with comment in zmq_poll
Solution:
Wrap and clean it.
2016-05-04 16:24:51 +01:00
Doron Somech
e15da4b38c problem: compilation error on osx 2016-05-04 16:09:31 +03:00
Doron Somech
4012538ce4 problem: srcfd is broken 2016-05-04 15:33:19 +03:00
somdoron
fca45921a8 problem: zeromq performance got worsen by some changes 2016-05-03 19:37:39 +03:00
Doron Somech
b3667cccf9 mark zmq_msg new methods as draft 2016-05-03 10:44:00 +03:00
Luca Boccassi
6de24c190a Problem: scatter/gather are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
caaf66c32c Problem: radio/dish are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
32a1ef85a8 Problem: zmq_timers* are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
738968082b Problem: zmq_poller* are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
7e700f1e73 Problem: client/server are not yet stable APIs
Solution: mark them as DRAFT APIs
2016-05-02 21:47:05 +01:00
Luca Boccassi
064cd1fbfb Problem: no support for DRAFT API in build systems
Solution: add support for --enable-drafts/ENABLE_DRAFTS=ON in
Autools and CMake.
2016-05-02 21:47:05 +01:00
Luca Boccassi
b469832409 Problem: precompiled.hpp ifdef'd for windows
Solution: include platform.hpp and include/zmq.h outside of ifdef
for windows, in order to be able to use it for internal definitions.
2016-05-02 20:00:53 +01:00
Luca Boccassi
b65fc903cd Merge pull request #1943 from hitstergtd/x-style-tunetcpkeepalives-fix
Problem: tune_tcp* related code has style issues
2016-05-02 17:25:48 +01:00
Luca Boccassi
b3ae7cfa0d Merge pull request #1937 from hitstergtd/test-add-sendiov
Problem: multiple issues with zmq_sendiov/recviov
2016-05-01 20:01:07 +01:00
hitstergtd
e4539778a4 Problem: multiple issues with sendiov/recviov
Solution:
- Add check for the [count] parameter in zmq_sendiov() and zmq_recviov()
- Use and add test for zmq_sendiov() in tests/test_iov.cpp
- Add error state tests for zmq_sendiov() in tests/test_iov.cpp
- Add error state tests for zmq_recviov() in tests/test_iov.cpp
- Cleanup tests/test_iov.cpp for style, consistency and clarity
- Generally improve test coverage for both API methods

Hat-tip:
@somdoron, @bluca
2016-05-01 19:41:50 +01:00
hitstergtd
a31c508979 Problem: tune_tcp* related code has style issues
Solution: fix it
2016-05-01 14:42:27 +01:00
hitstergtd
8820e35a56 Problem: style issues in decoder.hpp
Solution: fix it
2016-04-30 21:20:31 +01:00
Luca Boccassi
95acb29bfb Merge pull request #1934 from somdoron/master
problem: no documentation for Radio-dish and UDP
2016-04-29 10:40:56 +01:00
somdoron
34d5028ea8 allow specify binding address on radio with udp 2016-04-29 12:17:17 +03:00
hitstergtd
9218441f97 Problem: unistd.h redundantly included twice
Solution: fix it
2016-04-26 16:57:30 +01:00
hitstergtd
d3c800a237 Problem: tune_tcp_keepalives signature >80 chars
Solution: fix it
2016-04-25 13:43:10 +01:00
hitstergtd
b2d0ab18f2 Problem: trailing whitespace in code
Solution: fix them
2016-04-25 12:18:46 +01:00
hitstergtd
11311f9776 Problem: trailing spaces in code comments
Solution: fix them
2016-04-25 11:18:49 +01:00
hitstergtd
a4b426b18e Problem: typos/trailing spaces in code comments
Solution: fix them
2016-04-25 11:16:26 +01:00
hitstergtd
7feb1e49fc Problem: Windows IPC check broken (check_protocol)
Solution: Fix the preprocessor check from || to &&
2016-04-22 19:55:08 +01:00
Hitster GTD
99763cce41 Merge pull request #1909 from somdoron/master
problem: push-pull socket types are not thread safe
2016-04-21 12:54:04 +01:00
somdoron
e6dae56c6e Scatter-Gather socket types 2016-04-21 14:50:58 +03:00
Doron Somech
87e455f59b Fix UDP failing on windows 2016-04-21 14:00:02 +03:00
Luca Boccassi
c8211bf320 Problem: can't unbind with bound addr with IPv6
Solution: try to resolve the TCP endpoint passed by the user in the
zmq_unbind call before giving up, if it doesn't match.
This fixes a breakage in the API, where after a call to
zmq_bind(s, "tcp://127.0.0.1:9999") with IPv6 enabled on s would
result in the call to zmq_unbind(s, "tcp://127.0.0.1:9999") failing.
Add more test cases to increase coverage on all combinations of TCP
endpoints.
2016-04-18 18:43:36 +01:00
hitstergtd
8cb27316fa Problem: check_protocol() logic duplicated twice
Problem:
Conditional logic in check_protocol() that checks if a protocol is supported,
is duplicated twice. Moreover, the first set of checks to ascertain if a
protocol is supported is done regardless of whether the particular protocol
will be built into the library or not.

Solution:
* Simplify/collapse all supported protocol checks into one in check_protocol()
* Enclose pgm/epgm/norm socket+protocol match checks with requisite macros
2016-04-15 15:39:46 +01:00
hitstergtd
362377948e Problem: errno not set if UDP is NOT used with ZMQ_RADIO or ZMQ_DISH
Solution: set errno to ENOCOMPATPROTO in check_protocol()
2016-04-15 01:23:34 +01:00
hitstergtd
a17389eeb0 Fix typos similar to #1894 2016-04-14 21:10:12 +01:00
hitstergtd
6c3129286d Fix typo 2016-04-14 21:02:53 +01:00
Constantin Rack
3f77cf5a2f Merge pull request #1892 from bluca/solaris_fixes 2016-04-13 05:18:12 +02:00
Patrik Wenger
ba9a559fe5 Problem: PR #1891 wasn't complete
Solution: make the same change for the ZMQ_POLL_BASED_ON_SELECT case
2016-04-13 03:01:14 +02:00
Patrik Wenger
1afed1d32e Problem: tabs instead of spaces used for indentation
Solution: correct it to spaces
2016-04-13 03:01:14 +02:00
Luca Boccassi
edda1657fa Problem: pragma diagnostic is new in GCC 4.2
Solution: check for GCC version before using pragma diagnostic
in src/tweetnacl.c to avoid an additional warning.
2016-04-13 00:31:58 +01:00
Patrik Wenger
621c965fae Problem: tricky return value from zmq::socket_poller_t::wait when poller is empty
Solution: return -1 (no event) instead of 0 (event)

For some reason, this just returns 0 if there are no sockets registered
on the poller. Usually this would mean there has been an event. So the
caller would have to check the return value AND the event, or write code
that takes the number of registered sockets into consideration.

By returning -1 and setting errno = ETIMEDOUT like in the usual timeout
cases, it's more consistent and convenient.

Test case included.
2016-04-12 20:11:50 +02:00
Patrik Wenger
b5dc794202 Problem: zmq_poller_wait doesn't check *event arg
Solution: use zmq_assert to ensure it's not a nullpointer
2016-04-12 20:10:54 +02:00
Luca Boccassi
d570f57b6e Problem: ipc://* random dir created with USE_FD
Solution: if options.use_fd do not create temporary random
directory for ipc://*, since the socket is already created and
passed to the library by the user.
2016-04-11 00:18:51 +01:00
Luca Boccassi
f18463f323 Problem: mkdtemp not available on all platforms
Solution: check for availability in autoconf and cmake, and if not
available fall back to random file name rather than random directory.
2016-04-11 00:18:51 +01:00
Luca Boccassi
8028817f6b Problem: 1E9 is double but assigned to an int var
Solution: use the less nice but correct int constant 1000000000
instead of the shorter 1E9 to avoid a compiler warning when assigning
to timespec.tv_nsec, which is a long int.
2016-04-11 00:00:32 +01:00
Luca Boccassi
9cf6f85a25 Problem: redundant Windows errno conversion
Solution: in the Windows-specific ifdef in tcp_listener set_address,
check for error and set errno only after the IPv4 fallback has failed
too, to avoid setting errno when the socket creation succeeds through
the fallback.
2016-04-07 13:29:10 +01:00
Luca Boccassi
99a8795dfe Problem: zmq_connect (TCP) has no IPv4 fallback
Solution: if opening an IPv6 TCP socket fails because IPv6 is not
available, try to open an IPv4 socket instead when creating and
connecting a TCP endpoint.
2016-04-07 13:29:10 +01:00
Luca Boccassi
d169281a00 Problem: zmq_bind IPv4 fallback still tries IPv6
Solution: if opening an IPv6 TCP socket fails because IPv6 is not
available, try to open an IPv4 socket instead when creating and
binding a TCP endpoint.
2016-04-07 13:13:55 +01:00
Yuval Langer
37a4a4075e Fix NetBSD thread scheduling problem.
Defining thread priority for SCHED_OTHER is implementation defined.
Some platforms like NetBSD cannot reassign it as they are dynamic.

<http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getschedparam.html>

Credit goes to <kamil@netbsd.org> and <riastradh@netbsd.org> for finding this
solution.
2016-04-03 02:34:04 +03:00
Frederic Tregon
625b618776 Fixed ZMQ_REQ_CORRELATE (see pull request #1730)
Problem: Since pull request #1730 was merged, protocol for REQ socket is
checked at the session level and this check does not take into account
the possibility of a request_id being part of the message. Thus the option
ZMQ_REQ_CORRELATE would no longer work.
This is now fixed: the possiblity of a 4 bytes integer being present
before the delimiter frame is taken into account (whether or not this
breaks the REQ/REP RFC is another issue).
2016-04-02 18:36:29 +02:00
Eric Camachat
023b34a144 Fix issue #1419 segfault when using a XSUB/XPUB proxy.
Ref. https://github.com/zeromq/libzmq/issues/1419
2016-04-02 09:08:40 -07:00
Matt Powley
f2018ab317 Fixes for Windows XP compatibility
A Visual Studio build from master (commit id: dac5b45dfb) using the v140_xp toolset yields a binary that is not XP compatible.

Two libraries contain exports that cannot be found:
 -  IPHLPAPI.DLL : if_nametoindex
 - KERNEL32.DLL : InitializeConditionVariable

The latter export is already dealt with in the file './src/condition_variable.hpp'; however this requires setting the _WIN32_WINNT pre-processor definition.
I am not experienced enough to figure a work around for the 'if_nametoindex' method, so I have created a new pre-processor definition 'ZMQ_HAVE_WINDOWS_TARGET_XP' and removed the calling of the function with the limitation that these builds cannot handle a IPv6 address with an adapter name.

To make it easier for people targeting XP with an MSVC build I have modified the MSBuild property file to add/modify the pre-processor definitions if they are building using a XP targeting tool set; such as v140_xp.
2016-03-31 15:45:00 +01:00
Pieter Hintjens
e70e39be49 Problem: ctx.cpp still uses old HAVE_LIBSODIUM
I changed this to ZMQ_USE_SODIUM to be consistent with other
configuration options (especially ZMQ_USE_TWEETNACL).

Solution: fix it.
2016-03-30 14:39:34 +02:00
Pieter Hintjens
6a78b3ec19 Problem: HAVE_LIBSODIUM macro is inconsistent
Solution: use ZMQ_USE_LIBSODIUM to match ZMQ_USE_TWEETNACL
2016-03-30 14:19:20 +02:00
Nikolay Edigaryev
8673fa7b03 Problem: build fails when CURVE security is disabled
Solution: use proper preprocessor macro
2016-03-30 04:23:59 +05:00
Nikolay Edigaryev
884e00cb4a Problem: CURVE mechanism is unusable with chroot()
libsodium calls abort() when /dev/urandom can't be found
even if one creates ZeroMQ context before calling chroot()[1].

This happens because crypto gets initialized on handshake,
and at that moment the process is already chroot'ed.

Solution: initialize cryptographic libraries in ctx

randombytes_close() is already there in the destructor.

[1] https://download.libsodium.org/doc/usage/index.html
2016-03-30 03:45:12 +05:00
Jim Klimov
e9c8557e92 zeromq-4.1.4/src/tcp_address.cpp : fix relaxed use of sizeof() without parenthesis 2016-03-29 18:43:26 +02:00
Frederic Tregon
e45dfe3bc7 Fixed issue #1695 (ZMQ_REQ_CORRELATE)
Problem: when using ZMQ_REQ_RELAXED + ZMQ_REQ_CORRELATE and two 'send' are
executed in a row and no server is available at the time of the sends,
then the internal request_id used to identify messages gets corrupted and
the two messages end up with the same request_id. The correlation no
longer works in that case and you may end up with the wrong message.

Solution: make a copy of the request_id instance member before sending it
down the pipe.
2016-03-20 20:38:18 +01:00
Mário Kašuba
75579fe7d9 Added comment to sockaddr_storage 2016-03-19 14:49:22 +01:00
Mário Kašuba
e38166cc1b Use sockaddr_storage instead of sockaddr to support IPv6 addresses 2016-03-19 14:37:10 +01:00
Suudy
b6080a798c Updated handling of Unix Domain Sockets, make use of temporary directories, and cleanup afterward. Fix test_term_endpoint handling of optvallen 2016-03-14 12:17:49 -07:00
Claudio Scordino
cb1b6bc9ae Better comments for understanding the classes array_t<> and array_item_t<> 2016-03-08 11:24:58 +01:00
Luca Boccassi
ee31ea1348 Merge pull request #1838 from obache/neatsrc/fix-c-comment-style
Problem: Fix C++ style comment usage in C source
2016-03-04 09:41:29 +00:00
OBATA Akio
8c7c8ece2d Problem: Fix C++ style comment usage in C source 2016-03-04 17:26:02 +09:00
OBATA Akio
09e868b743 Problem: Fix build with Heimdal krb5
Solution:
* Check gssapi/gssapi_generic.h header file, it is not in Heimdal.
* Check libgssapi too, libgssapi_krb5 is not separated in Heimdal.
2016-03-04 16:38:57 +09:00
Luca Boccassi
ec6209737e Merge pull request #1832 from hintjens/master
Problem: can't be sure crypto_box always returns 0
2016-03-01 15:53:26 +00:00
Pieter Hintjens
5b7bf7509f Problem: can't be sure crypto_box always returns 0
Libsodium has started returning -1 in some cases.

Solution: allow and handle error returns from these calls.

Fixes #1831
2016-03-01 15:01:23 +01:00
Steven Chamberlain
dd8ccd5e0f include sys/ucred.h for struct ucred
Platforms that have struct ucred, typically declare it in sys/ucred.h
2016-02-28 20:42:54 +00:00
Luca Boccassi
80e529a16a Problem: all tests fail with assert in in_event
Solution: socket_base_t::in_event cannot do anything useful with
return status of process_commands. Asserting is the wrong solution,
as it is entirely valid to be interrupted or for the context to be
terminated, so discard the value.
2016-02-22 00:05:52 +00:00
Luca Boccassi
ae8efc21e8 Problem: nullptr is a reserved keyword in C++0x
Solution: use NULL instead to avoid build failure with older
compilers.
2016-02-21 23:54:18 +00:00
Luca Boccassi
7187169619 Problem: socket_poller_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:50:34 +00:00
Luca Boccassi
c84a52b11e Problem: udp_engine_t fd cannot be init to NULL
Solution: initialize to -1, since fd is a file descriptor (int).
2016-02-21 23:47:44 +00:00
Luca Boccassi
1046f35930 Problem: udp_engine_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:46:51 +00:00
Luca Boccassi
24b84081be Problem: socks_connecter_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:45:02 +00:00
Luca Boccassi
a6e49860f5 Problem: tcp_connecter_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:43:09 +00:00
Luca Boccassi
645c2be487 Problem: stream_engine_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:42:12 +00:00
Luca Boccassi
c21dd8d6a2 Problem: socket_base_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:41:02 +00:00
Luca Boccassi
acbf021a7c Problem: reaper_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:39:09 +00:00
Luca Boccassi
779bed6315 Problem: encoder_base_t initialization reorder
Solution: initialize class variable in the same order as they are
defined.
2016-02-21 23:37:10 +00:00
Luca Boccassi
de46fc6ac9 Problem: can't do anything with load.sub ret val
Solution: don't store it in zmq::poller_base_t::adjust_load, as the
build with Werror=unused=variable will fail otherwise.
2016-02-21 23:28:54 +00:00
Luca Boccassi
14054d28ed Problem: can't statically initialized pthread_t
Solution: remove statc initialization to NULL of thread.hpp pthread_t
descriptor. There is no portable way to statically initialize a
pthread_t variable.
2016-02-21 23:26:01 +00:00
Luca Boccassi
cf309a4e8c Problem: maxfd definition depends on ifdef
Solution: initialise it inside an ifdef too
2016-02-21 23:17:28 +00:00
Luca Boccassi
d4c0716473 Problem: indentation should be 4 spaces, no tabs
Solution: fix it
2016-02-21 23:16:44 +00:00
Constantin Rack
406b5738b6 Merge pull request #1823 from opedroso/COVERITY
Problem: Several problems found by Coverity Static Analyzer
2016-02-21 22:56:46 +01:00
Osiris
b3d5fa63a0 Problem: Several problems found by Coverity Static Analyzer
Solution: The Coverity Static Code Analyzer was used on libzmq code and found
many issues with uninitialized member variables, some redefinition of variables
hidding previous instances of same variable name and a couple of functions
where return values were not checked, even though all other occurrences were
checked (e.g. init_size() return).
2016-02-21 15:49:47 -06:00
Osiris
b4784d95bb roblem: Visual Studio Toolset was incorrectly set in VCXPROJ files
Solution: Corrected Toolset setting where needed and inprove compilation speed
by adding defintion of WIN32_LEAN_AND_MEAN prior to any Windows specific
include files, which skips non-essential definitions during compilation.
2016-02-21 14:23:18 -06:00
Pieter Hintjens
c5d8353429 Merge pull request #1819 from bluca/C++11
Bump C/C++ standard version support to C11/C++11
2016-02-21 11:17:26 +01:00
OBATA Akio
8eaa43d9d3 Problem: pgm/in.h is required on NetBSD too for struct group_req 2016-02-20 17:38:43 +09:00
Luca Boccassi
0782b58d9c Problem: tweetnacl warnings override not needed
Solution: remove it
2016-02-19 21:52:01 +00:00
Luca Boccassi
266500a9ff Merge pull request #1818 from opedroso/PRECOMPILED
Precompiled
2016-02-19 13:45:03 +00:00
Pieter Hintjens
8ae3671e88 Problem: tweetnacl gives many warnings on MSVC
Solution: disable the warnings on this file only

We use pragmas wrapped in compiler conditionals. This will need
extending to non-gcc/msvc compilers. We could also fix the warnings
in the code, though I suspect it's not really possible.
2016-02-19 10:52:31 +01:00
Osiris
79538ed651 Problem: Windows build not using precompiled header
Solution: Phase II - made compile using precompiled header
2016-02-18 11:35:35 -06:00
Osiris
4a5af9d58b Problem: Precompiled headers not being used
Solution: Phase I - make precompiled.hpp be first file included in every source file
2016-02-18 10:56:52 -06:00
somdoron
352ae1468f remove using of dynamic cast 2016-02-17 19:33:17 +02:00
Pieter Hintjens
7129187f87 Problem: getting various warnings in tweetnacl
libzmq used to switch off pedantic checks when using tweetnacl. As
this is now the default, that means pedantic checks are always off.
This is not good.

Solution: in tweetnacl.c alone, use a GCC pragma to disable sign
comparison warnings. We could also clean the code up yet this is
simpler. In other code, we still want those warnings, hence I've
used a pragma rather than global compile option.

Second, use -Wno-long-long all the time, as this warning does not
work with a pragma.

I removed code that set -wno-long-long, for MinGW and Solaris.

Related problem 2: --with-relaxed is badly named

This option switches off pedantic checks, so should be called
--disable-pedantic. 'with' is for optional packages.
2016-02-17 12:06:45 +01:00