1802 Commits

Author SHA1 Message Date
Luca Boccassi
1a9f3b1851 Problem: application metadata not parsed correctly when using CURVE
Solution: create buffers large enough to contain arbitrary metadata
2019-07-02 22:28:51 +01:00
Mark Martinec
78edebb34c Added error code EHOSTDOWN to the list of acceptable error codes.
Fixes #164 (EHOSTDOWN from getsockopt must not cause assertion abort;
            causes SaltStack crashes)
2017-09-14 14:47:33 +02:00
Marc Sune
10694373e3 Fix ROUTER's xhas_out() in MANDATORY mode
Before this commit, xhas_out() was returning true regardless. This
was correct before the ZMQ_ROUTER_MANDATORY flag as introduced.
However, ZMQ_POLLOUT.

With this commit, _if_ ZMQ_ROUTER_MANDATORY is set, xhas_out() will
return false if ALL peer's outgoing pipes are full.

There is an outstanding high-level design question:

If ZMQ_ROUTER_MANDATORY is set, and zmq_poll() waits for ZMQ_POLLOUT
events, zmq_poll() will immediately wake up if only 1 pipe has
room to send, regardless of the peer, creating a busy loop of
zmq_poll() wake-up, zmq_send() (EAGAIN). There is no way for
the application to selectively wait for ZMQ_POLLOUT for specific
peer(s), which seems somehow necessary in ZMQ_ROUTER_MANDATORY.

This discussion will be addressed in a separate issue.

Signed-off-by: Marc Sune <marc@voltanet.io>
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2017-07-21 11:21:32 +02:00
Martin Hurton
e67f935f3a Fix issue #1257 2017-04-07 09:06:48 +08:00
Patrick McLean
b5e25e9f12 fix divide by zero in zmq::lb_t::sendpipe
This is based on https://github.com/zeromq/zeromq3-x/pull/116/files
2017-01-27 17:08:00 -08:00
laplaceyang
e4e6af1876 fix bug zmq4.1.x PUB msg to ZMTP 1.0 SUB svr 2016-12-15 22:55:19 +08:00
Luca Boccassi
904d0bd8d3 Problem: socket_type_string off-by-one error
Solution: check socket type from 0 to 11 to include ZMQ_STREAM
2016-11-04 12:13:42 +00:00
Luca Boccassi
7302228026 Merge pull request #153 from jens-auer/2158
Fixed function prototypes
2016-10-21 12:40:22 +01:00
Jens Auer
56611dd46b Fixed function prototypes 2016-10-21 12:27:32 +02:00
Luca Boccassi
cd3680d178 Merge pull request #148 from jens-auer/backport-#1649
Merged PR 1649
2016-10-13 10:37:50 +01:00
Jens Auer
798532e0c5 Merged PR 1649
https://github.com/zeromq/libzmq/pull/1649/commits
2016-10-13 08:34:04 +00:00
Jens Auer
7aec4be368 Add mutex to socket monitor access
The monitor socket is used concurrently from different threads
and needs protection.
2016-10-13 08:32:20 +00:00
Luca Boccassi
d38a2d507d Problem: zmq_ctx_term asserts with connect-before-bind and sockets with identity over inproc transport
Solution: check if the connecting inproc socket has been closed
before trying to send the identity.
Otherwise the pipe will be in waiting_for_delimiter state causing
writes to fail and the connect to assert when the context is being
torn down and the pending inproc connects are resolved.
Add test case that covers this behaviour.
2016-09-24 19:45:54 +01:00
Luca Boccassi
acab1f487b Problem: zmq_connect with IPv6 "source:port;dest:port" format is broken
Solution: allow for '[' character when doing the basic sanity check
on the TCP endpoint.
Also add unit tests for both IPv4 and IPv6 source;dest format.
2016-09-17 20:04:21 +01:00
Jim Garlick
565892f3cd Problem: getifaddrs can fail with ECONNREFUSED
getifaddrs() can fail transiently with ECONNREFUSED on Linux.
This has been observed with Linux 3.10 when multiple processes
call zmq::tcp_address_t::resolve_nic_name() simultaneously.

Before asserting in this case, make 10 attempts, with exponential
backoff, given by (1 msec * 2^i), where i is the attempt number.

Fixes #2051
2016-07-20 10:15:55 -07:00
Luca Boccassi
330c682403 Merge pull request #124 from aburgm/issue-1542
Backport fix for issue 1542 to zmq 4.1.x
2016-06-04 10:28:56 +01:00
Matt Bolger
783fb45f9d -Set signaler_port to 0 which allows the OS to find a free port, rather than crashing if 5905 is in use (https://github.com/zeromq/libzmq/issues/1542)
-Added config.hpp to the source list so it shows up in generated projects
-Remove CMAKE_BUILD_TYPE setting for generators that don't use it
2016-06-03 19:20:33 -07:00
KIU Shueng Chuan
ca69183592 fix: sockets are not signed int on Windows 2016-05-09 21:31:09 +08:00
Luca Boccassi
0af39a443f 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-21 10:52:11 +01:00
Luca Boccassi
02d71a88ab Problem: missing () after sizeof cause build fail
Solution: use sizeof () to avoid build failure on Solaris 10 with
gcc 3.4
2016-04-13 00:14:25 +01:00
Luca Boccassi
1a1abe3d5e 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 14:16:35 +01:00
Luca Boccassi
1e87d92527 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 14:16:35 +01:00
Luca Boccassi
82aed1dee6 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 14:15:29 +01:00
Soren Hansen
bf92026527 Avoid terminating connections prematurely
While sending very large messages (far beyond what fits in a the tcp
buffer, so it takes multiple sendto system calls for it to finish),
zmq_close will close the connection regardless of ZMQ_LINGER.

In case no engine is attached, a pipe->check_read() is needed to look
for the delimiter in the pipe and ultimately trigger the pipe
termination.

However, if there *is* an engine attached, the check_read() looks ahead
and finds the delimiter and terminates the connection even though the
engine might actually still be in the middle of sending a message.

This happens because while the io_thread is still busy sending the data,
the pipe can get terminated and the io thread ends up being terminated.
2016-03-30 17:04:48 +01:00
Pieter Hintjens
bbe4f3ede4 Problem: does not build on Windows with libsodium
Solution: fixed wrong condition around randombytes_close ().
2016-03-15 06:26:34 +01:00
Pieter Hintjens
98834596f1 Problem: cannot disable encryption if libsodium is installed
The sodium/tweetnacl detection logic does not yet you disable
encryption if libsodium is installed.

Fixes #1850 in libzmq/master
2016-03-12 15:40:24 +01:00
Pieter Hintjens
58badc44c1 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 17:01:00 +01:00
Luca Boccassi
6a66c05179 Problem: curve keys getsockopt uninitialised read
Solution: always initialised zmq::options_t class variables arrays to
avoid reading uninitialised data when CURVE is not yet configured and
a getsockopt ZMQ_CURVE_{SERVER | PUBLIC | SECRET]KEY is issued.

Backport from libzmq.
2016-02-16 13:40:40 +00:00
Pieter Hintjens
4cee289697 Problem: Windows 7 TCP slow start
See issue #1608.

This is an old issue with Windows 7. The effect is that we see a latency
ramp on the first 500 messages.

* The ramp is unaffected by message size.
* Sleeping up to 100msec between sends has no effect except to switch
    off ZeroMQ batching so making the ramp more visible.
* After 500 messages, latency falls back down to ~10-40 usec.
* Over inproc:// the ramp happens when we use the signaler class.
* Client-server over inproc:// does not show the ramp.
* Client-server over tcp:// shows a similar ramp.

We know that the signaller is using TCP on Windows. We can 'prime' the
connection by doing 500 dummy sends. This potentially causes new sockets
to be delayed on creation, which is not a good solution.

Note that the signaller sends zero-byte messages. This may also be
confusing TCP.

Solution: flood the receive buffer when creating a new FD pair; send a
1M buffer and discard it.

Fixes #1608
2016-02-16 12:01:45 +01:00
meox
49593151db [PATCH] fix error with gcc 5.2 2016-02-12 21:57:51 +00:00
Michael
2058dece77 added windows.hpp with include check
windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600
2016-02-12 23:36:48 +11:00
Michael
45404f4b06 added windows.hpp with include check
windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600
2016-02-12 23:36:07 +11:00
Michael
6f4e9f13f3 changed order of includes
windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600
2016-02-12 23:34:43 +11:00
Michael
af3b9452a2 remove include that is already in header 2016-02-12 23:33:22 +11:00
Min RK
e68c2d2563 Revert "update minimum _WIN32_WINNT version to 0x0600 for 4.1.4 onwards" 2016-02-11 14:00:41 +01:00
Michael
e3fba7d447 updated minimum _WIN32_WINNT version to 0x0600
if_nametoindex requires minimum windows version vista, which is 0x0600
2016-02-02 22:32:16 +11:00
Ilya Kulakov
0c5c536303 Backport zeromq/libzmq#1723 2016-01-21 19:56:23 +06:00
Ilya Kulakov
4788c7d2a9 Backport zeromq/libzmq#1722 2016-01-21 13:47:55 +06:00
Pieter Hintjens
795a7e3de2 Revert "Fix missing include for if_nametoindex on Windows."
This reverts commit b9dbc5b8caea5491c7330d891e93e2791d84c906.
2016-01-18 13:04:00 +01:00
Pieter Hintjens
95766dd09c Revert "Add missing support for IPv6 link local addresses (which include % followed by the interface name)"
This reverts commit 849e5b07d982e7c0917a13d9ff22d447817dd7fe.
2016-01-18 13:03:49 +01:00
Ilya Kulakov
b9dbc5b8ca Fix missing include for if_nametoindex on Windows.
Raise min version to Vista.
2015-12-18 19:42:44 +06:00
Sathish Yenna
849e5b07d9 Add missing support for IPv6 link local addresses (which include % followed by the interface name) 2015-12-10 00:15:51 +01:00
Sergey Kovalevich
5ee936a9be backport https://github.com/zeromq/libzmq/pull/1604 2015-11-20 13:54:16 +02:00
somdoron
af543a58f2 Fix a bug when stream_engine try to set alreadt set metadata 2015-11-19 14:01:05 +02:00
Constantin Rack
89d4e995ef Problem: return code of sodium_init() is not checked.
There are two todo comments in curve_client.cpp and curve_server.cpp that suggest
checking the return code of sodium_init() call. sodium_init() returns -1 on error,
0 on success and 1 if it has been called before and is already initalized:
https://github.com/jedisct1/libsodium/blob/master/src/libsodium/sodium/core.c
2015-11-03 18:04:42 +02:00
Min RK
28432b562d Revert "stdint.h is available in VS2008 (1500)" 2015-11-03 09:56:19 +01:00
Pieter Hintjens
a73740b304 Backported fix for #1399
Problem: asserts if EINVAL recieved on read/write

This causes assertion failures after network reconnects.

Solution: allow EINVAL as a possible condition after read/write.

Fixes #829
Fixes #1399

Patch provided by Michele Dionisio @mdionisio, thanks :)
2015-11-01 09:10:09 +01:00
Rik van der Heijden
a9ca06847b Fix issue #52, reset all bits in getsockopt 2015-08-01 10:28:57 +02:00
Marin Atanasov Nikolov
5bd3a0d433 Typo fix 2015-06-23 14:34:33 +03:00
Constantin Rack
81464652d2 Solution: allow brackets in tcp address. Fixes #43 2015-06-23 08:29:36 +02:00