Commit Graph

3104 Commits

Author SHA1 Message Date
Bill Torpey
6bf7728e6e ZMQ_RECONNECT_STOP options are intended to be inclusive (i.e., can be OR'ed together), and so values must be powers of two 2021-04-28 10:30:35 -04:00
Jose Santiago
e6e683731d Fix MINGW with pthread cv
ZeroMQ works and MINGW and pthread conditional variables if pthread
mutexes are used. POSIX conditional variables require POSIX mutexes, but
ZeroMQ unconditionally uses WIN32 critital sections even when configured
with pthread conditional variables. This of course does not work. This
patch fixes the build so that MINGW builds do not use WIN32 critical
sections and instead use POSIX mutexes when configured with pthread
conditional variables.

Tested with:

```
 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ ../libzmq/configure --host=x86_64-w64-mingw32 --prefix=`pwd`/stage --enable-debug --disable-Werror --enable-libunwind=no   --with-cv-impl=pthread --enable-libbsd=no
```

```
x86_64-w64-mingw32-gcc --version

   x86_64-w64-mingw32-gcc (GCC) 10.2.0.....
```
2021-04-15 13:43:55 -05:00
Luca Boccassi
b82777bfb6 Problem: compiler error with GCC 11
Solution: downcast size to uint32_t to match vector size
range
2021-03-20 19:22:46 +00:00
Luca Boccassi
bd5f5a1093
Merge pull request #4148 from bluca/vmci
Problem: VMCI build broken
2021-02-23 11:57:18 +00:00
Luca Boccassi
8fe5b54b8a Problem: VMCI build broken
Solution: refactor it
2021-02-21 11:50:38 +00:00
Gudmundur Adalsteinsson
c325ed127e Problem: strtok is not thread safe
Solution: use strtok_r
2021-02-20 20:29:17 +00:00
Luca Boccassi
c515671bc8
Merge pull request #4145 from gummif/gfa/malloc-vec
Problem: C style malloc and free
2021-02-19 14:06:20 +00:00
Gudmundur Adalsteinsson
10078a9225 Problem: Unused member variables _last_in
Solution: Remove them
2021-02-18 20:38:42 +00:00
Gudmundur Adalsteinsson
4b61c67ef0 Problem: C style malloc and free
Solution: use new and delete
2021-02-18 20:31:55 +00:00
Luca Boccassi
54c7f7969b Problem: formatting errors
Solution: run make clang-format-diff
2021-02-08 11:39:09 +00:00
Tarmo Tänav
2df7ab6aee Problem: XPUB socket allows manual subscription on terminated pipe
Solution: Avoid setting pipe as _last_pipe if it has been terminated
2021-02-08 06:02:10 +02:00
sab24
133f0d00b6 Fixes indentation 2021-01-30 16:40:26 +01:00
sab24
15408f5609 Fixes Firefox WebSocket upgrade request in WebSocket engine 2021-01-30 16:23:48 +01:00
Lingqiao Zhao
cc65a9ec93
Problem: exception thrown when debugging cl.exe x64 build with LLDB (#4129)
* Problem: exception thrown when debugging
cl.exe x64 build with LLDB

Solution: Use __try __except with cl.exe and
use pthread_setname_np with MinGW.
Remove usage of pushing exception handler
to TIB->ExceptionList.
2021-01-27 10:39:48 +00:00
mjvankampen
2dd24d6d80
Problem: norm fails to compile under windows (#4123)
* Makes norm useable (but maybe slow) on windows
2021-01-18 08:42:14 +00:00
Luca Boccassi
0742d432e7 Problem: build still broken on kFreeBSD
Solution: fix refactor mistake introduced by:

    091df743a8

    Fixes https://github.com/zeromq/libzmq/issues/4113
2021-01-08 20:41:51 +00:00
Luca Boccassi
2bf998f7e0 Problem: build broken on kFreeBSD
Solution: fix refactor mistake introduced by:

091df743a8

Fixes https://github.com/zeromq/libzmq/issues/4113
2021-01-06 22:23:09 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Pierre Yager
dcb6a24ed0 Cleanup socket FD after pair is established. Fix #4086
Avoid filling Temp directory with temporary files.
2021-01-04 17:00:58 +01:00
Luca Boccassi
41c4ce1817 Problem: ZMQ_PUB broken on ZMQ_WS
Solution: encode subscribe/cancel messages until there are appropriate
opcodes.
Regression introduced by 253e9dd27b

Fixes https://github.com/zeromq/libzmq/issues/4101
2020-12-23 17:44:07 +00:00
Stanisław Maciaś
26cbd4f43f if_nametoindex function is now used when available 2020-12-23 12:32:16 +01:00
Gudmundur Adalsteinsson
83032a4d33
Problem: Build error on MSVC with C++20 in ip.cpp
Solution: Move initialization of variables before gotos.
2020-12-18 10:32:59 +00:00
Bill Torpey
57e9551744 The _DEBUG preprocessor definition is typically only set on Windows. (e.g., see https://stackoverflow.com/questions/2290509/debug-vs-ndebug/29253284#29253284) 2020-11-02 16:58:14 -05:00
Fabrice Fontaine
8cb5708829 src/compat.hpp: fix build with libbsd and strlcpy
Don't include bsd/string.h if strlcpy is also defined in string.h to
avoid the following build failure on uclibc:

In file included from src/compat.hpp:41:0,
                 from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bsd/string.h:44:54: error: declaration of 'size_t strlcpy(char*, const char*, size_t)' has a different exception specifier
 size_t strlcpy(char *dst, const char *src, size_t siz);
                                                      ^
In file included from src/compat.hpp:34:0,
                 from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/string.h:424:15: error: from previous declaration 'size_t strlcpy(char*, const char*, size_t) throw ()'
 extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
               ^

Fixes:
 - http://autobuild.buildroot.org/results/51220b1b82774e8f6f6ed8593c58d2e3c31a1531

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-11-02 07:58:01 +01:00
Luca Boccassi
97b5f8560d Problem: formatting errors
Solution: run make clang-format-diff
2020-10-09 20:08:05 +01:00
Martin Labsch
3156764265 fix stack overflow on windows x64 2020-10-09 15:17:46 +02:00
Luca Boccassi
22d218a182 Problem: CI fails with formatting errors
Solution: run make clang-format-diff
2020-09-28 10:30:20 +01:00
C-sir
d4f03edd47
stop reconnect after called zmq_disconnect() (#4053) 2020-09-28 09:59:57 +01:00
Stéphane Valès
1495ccad58
Problem: warnings with xcode (#4043)
* remove override instructions to avoid a chain reaction with other overridden functions missing it

Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>
2020-09-17 15:12:36 +01:00
Luca Boccassi
792ffe4d7a Problem: zmq_ctx_get API broken
Solution: restore EINVAL as errno on unknown option.
Broken by https://github.com/zeromq/libzmq/pull/3642 which started to
return EFAULT instead
2020-09-10 22:37:01 +01:00
Luca Boccassi
04ac547c20
Merge pull request #4030 from sigiesec/test-coverage-3
Problem: code duplicated between handshake and out_event
2020-09-04 16:24:28 +01:00
Simon Giesecke
6a45737073 Problem: code duplicated between handshake and out_event
Solution: extract do_handshake member function
2020-09-04 16:39:16 +02:00
Simon Giesecke
af7df64ae7 Problem: mask and to_string member functions of tcp_address_mask_t are not referenced
Solution: remove them
2020-09-04 15:51:43 +02:00
Simon Giesecke
eb7b7db05d Problem: assert used instead of zmq_assert
Solution: replace by zmq_assert
2020-09-04 10:58:16 +02:00
Luca Boccassi
97f8274129 Problem: setsockopt of CURVE key ignores parameter length
Solution: create std::string using length to avoid overflow
2020-08-23 13:47:17 +01:00
Luca Boccassi
2fb04c1018 Problem: ZMQ_METADATA setsockopt ignores length and assumes nUL-terminated string
Solution: use length too
2020-08-22 17:01:10 +01:00
Luca Boccassi
b84e164698 Problem: zmq_z85_decode doesn't check its input length
Solution: do it
2020-08-21 16:03:57 +01:00
Luca Boccassi
a4dbdb614e Problem: some platforms do not have strnlen
Solution: move compat redefinition to compat.hpp header so that
it can be used from msg.cpp
2020-08-21 14:39:08 +01:00
Luca Boccassi
b02bdd566a Problem: ws_engine leaks memory if Sec-WebSocket-Protocol header passed multiple times
Solution: ensure it's passed only once
2020-08-16 22:35:42 +01:00
Luca Boccassi
c733067d6d Problem: use-after-free in WS
Solution: bail out of the stream engine out_event if ws_engine raises
an error
2020-08-15 14:31:09 +01:00
Luca Boccassi
110551d5df Problem: formatting errors
Solution: apply clang-format-diff
2020-08-15 12:26:14 +01:00
Luca Boccassi
1668432894 Problem: WS might use handshake buffer for data
Solution: check for it before reusing it to avoid overflows
2020-08-15 12:25:52 +01:00
Stéphane Valès
3da6fde592
Problem : if socket is invalid for any reason, as_socket_base_t() will return NULL and 'as_socket_base_t (items_[i].socket)->is_thread_safe ()' will crash (#4004)
* Problem : if socket is invalid for any reason, as_socket_base_t() will return NULL and 'as_socket_base_t (items_[i].socket)->is_thread_safe ()' will crash

Solution: expand the code to test the returned value from as_socket_base_t() before calling is_thread_safe() and make zmq_poll() return -1 if as_socket_base_t() returned NULL.

NB: this occurred on the destruction of a SUB socket while running a zloop and without previously calling zloop_reader_set_tolerant and zloop_reader_end. When entering zmq_poll, the PUB socket was already destroyed but still registered in the poll items.

NB: making zmq_poll return -1 is OK as it is what happens anyway, and errno is properly set to ENOTSOCK by as_socket_base_t() when it returns NULL.

Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
2020-08-07 09:13:52 +01:00
Davit Kalantaryan
0a424486a0
Modifications to compile code for WINDOWS ARM and ARM64 (#4003)
* Modifications to compile code for WINDOWS ARM and ARM64

[why]
In order to compile ZMQ related software on WINDOWS ARM

[how]
Replaced code in the file clock.cpp around the line 240.
Added intrinsics for ARM to replace '__rdtsc'

[todo]
Find proper tick counter query for ARM64 (see file:clock.cpp,line:~250)

* RELICENSEing

[why]
To make usage of changed code properly usable by libzmq project team

[how]
Added file /RELICENSE/kalantar.md with necessary information
2020-08-06 17:41:15 +01:00
Luca Boccassi
7deb8ded43
Merge pull request #3996 from tarmo/xpub-unmatch
Problem: XPUB keeps matched pipes between failed non-blocking sends
2020-07-29 17:35:18 +01:00
Tarmo Tänav
27bf9bf7d0 Problem: XPUB keeps matched pipes between failed non-blocking sends
Solution: always unmatch all pipes before matching for an initial
message part.
2020-07-29 16:35:43 +03:00
Luca Boccassi
4dd504abeb
Merge pull request #3973 from bluca/fuzzers
Problem: test_security_zap occasionally segfaults
2020-06-30 16:02:04 +01:00
Doron Somech
fb852fd3e7 problem: pthread_cond_timedwait sometimes fail with EINVAL
Solution: fix rounding error and assert if the clock_gettime fails
2020-06-28 17:02:38 +03:00
Luca Boccassi
350b4b34f4 Problem: test_security_zap occasionally segfaults
Solution: check if a session's _pipe has been allocated before using
it, since as a consequence of creating the pipes after the handshake
it's no longer guaranteed to be there.

Fixes #3971
2020-06-28 13:37:07 +01:00
Luca Boccassi
1ddfeb56ec Problem: formatting errors
Solution: run make clang-format-diff
2020-06-26 23:45:39 +01:00