0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 10:18:01 +08:00

1754 Commits

Author SHA1 Message Date
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
Gabi Davar
8a41475b74 stdint is available in VS2008 (1600) 2015-06-19 14:49:04 +03:00
Min RK
fd7ba4d509 don't check POLLOUT for single-socket proxies 2015-06-07 11:09:08 -07:00
Pieter Hintjens
d5a66f7b7d Merge pull request #32 from hintjens/master
Problem: source file headers are somewhat confusing about LGPLv3
2015-06-02 23:41:02 +02:00
Pieter Hintjens
b0a69fc623 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:47:01 +02:00
Rik van der Heijden
b5a00b76e8 Fix another degradation, CPU maxes out when POLLOUT is set because poll exits on POLLOUT and doesn't wait for POLLIN. 2015-05-27 14:21:47 +02:00
Rik van der Heijden
3a0f218cae Fix degradation from #1382, POLLOUT was tested but not requested 2015-05-24 22:38:22 +02:00
Rik van der Heijden
f5e1c607a5 Merged fix for #1382 2015-05-01 11:26:26 +02:00
Martin Hurton
6f75687c9e pub: Don't delay pipe termination 2015-05-01 08:42:54 +02:00
Martin Hurton
8e26e4b35c push: Don't delay pipe termination 2015-05-01 08:42:38 +02:00
Pieter Hintjens
fee19e26ac Problem: shutdown asserts if WSASTARUP wasn't done previously
This is a silly assertion that causes problems if libzmq.dll is
called in some esoteric ways.

Solution: if the shutdown code detects WSANOTINITIALISED, then
exit silently.

Fixes #1377
Fixes #1144
2015-04-21 23:23:42 +02:00
Martin Hurton
160a7efae4 Adjust number of sent messages on hiccups
Not adjusting the sent message count may lead to situation when SUB
socket does not forward its subscriptions.
2015-02-20 09:13:47 +01:00
Thomas Rodgers
73fa40b9ac resolve #1347 addresses issue of no metadata on identity frame 2015-02-19 13:31:26 -06:00
Thomas Rodgers
2a3379af4d Revert "resolve #1347 addresses issue of no metadata on identity frame"
This reverts commit f75ed8565e984f423e748717108486b458d5a724.
2015-02-19 13:27:18 -06:00
Thomas Rodgers
f75ed8565e resolve #1347 addresses issue of no metadata on identity frame 2015-02-19 13:26:26 -06:00
Thomas Rodgers
d172875f52 Backport resolve #1357 Support limited metadata for STREAM sockets 2015-02-18 13:09:11 -06:00
Thomas Rodgers
48ed789c18 Revert "STREAM socket support for limited metadata"
This reverts commit 5afd4e16edb51a3996c8d4b9f698dea8d2917c43.
2015-02-18 12:36:21 -06:00
Thomas Rodgers
c6d5c965fa Revert "Remove debugging cruft"
This reverts commit bbecdf397e0661ff469eb4898008c09d00efc397.
2015-02-18 12:36:19 -06:00
Thomas Rodgers
a69a043e14 Revert "Add connector.close() back"
This reverts commit 5e60f18d3a68947f469346162deae7e65732ba50.
2015-02-18 12:36:13 -06:00
Thomas Rodgers
5e60f18d3a Add connector.close() back
Needed if session->push() ever fails
2015-02-18 11:17:41 -06:00
Thomas Rodgers
bbecdf397e Remove debugging cruft 2015-02-18 11:14:23 -06:00
Thomas Rodgers
5afd4e16ed STREAM socket support for limited metadata
WIP - STREAM socket support for limited metadata

STREAM socket support for limited metadata
2015-02-18 11:12:32 -06:00
Thomas Rodgers
5229eeef5b resolve #1347 Backport zmq_msg_gets "Peer-Address" 2015-02-14 10:44:52 -06:00
Topher Brown
89dd9fddaf close (clean up) unsendable messages 2015-01-22 16:56:30 -05:00
Pieter Hintjens
583a5f9601 Merge pull request #14 from metadings/master
Upgrading zmq_msg_t to 64 bytes
2015-01-14 13:31:24 +01:00
metadings
d206fe2d45 Upgrading zmq_msg_t to 64 bytes 2015-01-14 13:26:48 +01:00
Thomas Rodgers
8f236dc55e resolve #1296 Remove of ZMQ_IDENTITY_FD socket option
Revert "linking fd to pipe identity via socket option"

This reverts commit fe3e8c5c70dc3fbcb0244c5f4c52dcd71b80f858.

Conflicts:
	include/zmq.h
	src/pipe.hpp
	src/session_base.cpp
2015-01-09 18:14:22 -06:00
Min RK
14c94c0df9 add session->zap_enabled()
checks mechanism != NULL, or NULL + non-empty zap_domain
2014-12-04 13:42:15 +01:00
Min RK
56e09c80f8 reject old ZMTP connections if auth enabled
auth mechanisms were only enabled when ZMTP handshake
is latest version, meaning that connections from old sockets
would skip authentication altogether
2014-12-04 13:42:07 +01:00
lysyloren
ed6bf9f178 Unbind socket with real endpoint when binding by wild-card * address 2014-10-29 10:17:30 +01:00
Martin Hurton
03c35d2659 Fix issue #1224 2014-10-23 10:28:19 +02:00
Phillip Mienk
6f9ad96225 Remove local pgm configuration option, cleanup configure.ac, remove unused Makefile.am instances. 2014-10-15 18:33:33 -07:00
Pavel Pimenov
18ee219ce7 Fix V815 Decreased performance. Consider replacing the expression 'peer_address = ""' with 'peer_address.clear()'. stream_engine.cpp 99 2014-10-09 09:41:49 +04:00
Pavel Pimenov
0e3d40c806 Fix V815 Decreased performance. Consider replacing the expression 'options.socks_proxy_address != ""' with '!options.socks_proxy_address.empty()'. session_base.cpp 497 2014-10-09 09:40:59 +04:00
Pavel Pimenov
0b541b789a Fix V803 Decreased performance. In case 'it' is iterator it's more effective to use prefix form of increment.
Replace iterator++ with ++iterator. stream_engine.cpp
    http://www.viva64.com/en/d/0165/print/
2014-10-09 09:37:55 +04:00
Dan Mick
8fde2d646c src/Makefile.am: libzmq.vers must go in dist tarball
Signed-off-by: Dan Mick <dmick@redhat.com>
2014-10-01 20:49:38 -07:00
Dan Mick
91cc9a2fd0 src/Makefile.am: i_properties.hpp removed some time ago
Signed-off-by: Dan Mick <dmick@localhost.localdomain>
2014-10-01 15:39:03 -07:00
Michaël Paul
7c5906d138 Problem : Build failed with MinGW on windows 2014-09-24 15:46:43 +02:00
Matthew Hawn
0900a48921 Problem: curve messages can be replayed
Solution: ensure message short nonces are strictly increasing and validate them
2014-09-19 18:07:57 -06:00
Martin Hurton
fe4396c597 Merge pull request #1188 from hintjens/master
Problem: stream_engine.cpp security can be downgraded
2014-09-19 20:16:09 +02:00
Pieter Hintjens
77f14aad95 Problem: stream_engine.cpp security can be downgraded
Solution: accept only the mechanism defined by the socket options.

I've not tested this yet, so it's a speculative fix.
2014-09-19 19:24:45 +02:00
Jim Hague
94943bab3b Fix hang terminating PGM ZMQ_SUB (#822). 2014-09-17 17:21:44 +01:00
Huu Nguyen
5642366f10 Fix non-constant-expression narrowing
For OS X, the microseconds field is implemented as an int type. The implicit narrowing in the initializer list throws a compiler error for some compilers with C++11 support turned on. The specific error message is: "error: non-constant-expression cannot be narrowed from type 'long' to '__darwin_suseconds_t' (aka 'int') in initializer list [-Wc++11-narrowing]".

Tested on Clang 5.1.0 and Mac OS X 10.9.4.
2014-09-16 14:34:11 -07:00
Martin Hurton
50e0915f98 Stop session's timer when pipe terminates 2014-09-12 16:53:05 +02:00
Martin Hurton
5a497d7d0c Code cleanup 2014-09-11 16:01:56 +02:00
Jonathan Reams
d1881acbdc Clean up after using randombytes from libsodium
When Curve authentication is used, libsodium opens a file
descriptor to /dev/urandom to generate random bytes. When
the ZMQ context terminates, it should ensure that file gets
closed.
2014-08-31 13:30:44 -04:00
Pieter Hintjens
f15146b5d2 Problem: nodrop code is ugly
It's bad practice to start by testing all exceptional conditions
and then dropping through to the 'normal' condition. Apart from
being inefficient, it's deceptive to the user. Conditional code
should always try to show the natural expectation of the code,
with exceptional cases coming last.

Solution: clean up this code.
2014-08-27 13:51:25 +02:00
Pieter Hintjens
35040aaf18 Problem: issues with nodrop property
- not initialized before use
- name is nasty (boolean variables should not have negative names)

Solution: rename to 'lossy' and initialize to 'true'.
2014-08-27 12:06:54 +02:00
Martin Hurton
f550d66ae3 Code cleanup 2014-08-14 08:58:01 +02:00
Kapp Arnaud
fbdc5aa22d Add const qualifier to source parameters in zmq_z85_decode and zmq_z85_encode 2014-08-14 00:00:00 +02:00
Martin Hurton
a54d8d7b0c Reset metadata for outbound messages 2014-08-13 08:53:54 +02:00
Pieter Hintjens
75d4f50be3 Problem: ZMQ_CURVE_SECRETKEY reads beyond end of Z85 data
Solution: change setsockopts on printable keys to expect 41, nor 40
bytes. Code still accepts 40 bytes for compatibility, and copies the
key to a well-terminated string before using it.

Fixes #1148
2014-08-12 12:37:49 +02:00
Martin Hurton
214553972d Return -1 when failed to publish message 2014-08-12 10:51:37 +02:00
Martin Hurton
228426ac44 Code cleanup 2014-08-12 09:31:19 +02:00
kreuzberger
f042ea9e26 better naming of flags and variables to real functionality: nodrop 2014-08-08 19:45:41 +02:00
kreuzberger
d9a3cc48d4 do not silently drop messages in publisher if hwm is reached 2014-08-08 19:36:00 +02:00
Thomas Rodgers
03f097a541 Update zmq_msg_get(ZMQ_SHARED) to return true for type_cmsg messages 2014-07-29 13:43:38 -05:00
KIU Shueng Chuan
6bcced7537 use enum retired_fd instead of -1 2014-07-29 04:16:44 +08:00
Ewen McNeill
501666d07e z/OS: Skip pthread_{get,set}schedparam
Updated:
    src/thread.cpp: On older z/OS UNIX System Services,
        pthread_{get,set}schedparam is not present (searching the
        Internet suggests it may be present in later version than
        the one being used for z/OS UNIX System Services porting).

        Make zmq::thread_t::setSchedulingParameters() a no-op on
        z/OS UNIX System Services.

    NOTE: pthread_{get,set}schedparam appear to have been introduced
    by POSIX.1-2001 or IEEE 1003.1-2004 so may not be universally
    available, and thus more platforms may need this "no-op" treatment.
2014-07-24 13:54:21 +12:00
Ewen McNeill
217e0ae9c6 Remove "const" from std::map key
Updated:
    src/metdata.hpp: Remove explicit "const" from key of std::map<>
       because the key is implicitly const already (see
       http://en.cppreference.com/w/cpp/container/map and
       http://www.cplusplus.com/reference/map/map/).

On some platforms (such as z/OS UNIX System Services) explicitly
declaring the map key as "const" causes template expansion errors
as it tries to create separate allocators for "const const std::string"
and "const std::string" only to find that they clash.  (Presumably
some compilers collapse these into one earlier.)

There are no template expansion errors if the map key is left to be
implicitly const.
2014-07-24 12:26:13 +12:00
Ewen McNeill
0af693c496 z/OS: Loop on EAGAIN on close() in ~signaler
Updated:
    src/signaler.cpp: Add close_wait_ms() static function to loop
       when receiving EAGAIN in response to close(), with ms long
       sleeps, up to a maximum limit (default 2000ms == 2 seconds);
       used in signaler_t::~signaler_t() destructor.
2014-07-23 14:01:43 +12:00
Pieter Hintjens
d4d65da20d Merge pull request #1131 from rodgert/master
Added ZMQ_SHARED message option to zmq_msg_get()
2014-07-12 16:06:26 +02:00
Thomas Rodgers
3497244c41 Added ZMQ_SHARED message option to zmq_msg_get() 2014-07-12 09:01:27 -05:00
Martin Hurton
816299f11c Code cleanup 2014-07-09 14:07:32 +02:00
Martin Hurton
54e0fde1cc Resolve issue #949 2014-07-09 10:02:53 +02:00
Tom Whittock
993cb32e96 Windows: if WSA error number is held, use directly.
It must be done this way, as WSAGetLastError returns 0 in these circumstances
2014-07-07 16:33:53 +01:00
Martin Hurton
ccfbaea397 Don't delay reception of signal
- new code may help undersdtand issue #1108
  (https://github.com/zeromq/libzmq/issues/1108)
- code cleanups
2014-07-06 22:27:45 +02:00
Rodrigo Mosconi
3a16b0b108 Merge remote-tracking branch 'upstream/master' 2014-07-02 21:22:51 -03:00
Rodrigo Mosconi
51b3fad8ab Fix to build on OpenBSD 2014-07-02 21:06:33 -03:00
Joel Lauener
219310b4f0 Thread scheduling parameters: Use ZMQ context options instead of
environment variables.
2014-07-02 14:41:21 +02:00
Martin Hurton
079ff8b759 Code cleanup 2014-07-01 09:17:19 +02:00
Franco Fichtner
f1207e6af1 socks: fix build on FreeBSD
The fix should be sane on all UNIX-like systems, so there's
no ZMQ_HAVE_FREEBSD involved.  It's likely that other BSDs
stumble across this problem too.
2014-06-27 20:15:08 +02:00
Pieter Hintjens
dd05a64462 Problem: zmq_msg_gets did not set errno on unknown properties
Solution: set errno to EINVAL when a property does not exist.

Also fixed test_metadata.cpp to test this case.
2014-06-25 17:28:36 +02:00
Pieter Hintjens
6e91330a0c Added clarifying comment 2014-06-25 14:37:54 +02:00
Pieter Hintjens
58c067ff0e Revert "Problem: tcp_address.cpp allowed [ and ] around address"
This reverts commit 78a7b469a1993b681031f513d0c750c3a8454bb8.
2014-06-25 14:36:55 +02:00
Pieter Hintjens
ce8fbb26cb Problem: zmq_connect doesn't return EINVAL on invalid endpoint
Solution: set errno to EINVAL when tcp:// endpoint is invalid (was just
leaving errno to previous value).
2014-06-25 12:48:26 +02:00
Pieter Hintjens
2524e26893 Code cleanups 2014-06-25 12:47:39 +02:00
Joel Lauener
112ef6f172 Allow change of pthread priority
Rationale: In a real-time environment it is sometime mandatory to tune
threads priority and scheduling policy. This is required by our users
who mixes real-time and server threads within
the same process. It's not planned to support this on non-pthread
platforms (e.g. Windows).
2014-06-25 09:51:10 +02:00
Pieter Hintjens
78a7b469a1 Problem: tcp_address.cpp allowed [ and ] around address
This syntax is undocumented and has no known meaning. It was in libzmq
since 3.x.

Solution: remove this code.
2014-06-24 14:36:21 +02:00
Pieter Hintjens
deaad00ad9 Problem: zmq_connect() does not validate TCP addresses
Since https://github.com/zeromq/libzmq/commit/350a1a, TCP addresses
get resolved asynchronously, so zmq_connect no longer returned an
error on incorrect addresses.

This is troublesome since we rely on some error checking to catch
blatant errors.

Solution add some upfront syntax checking that catches at least the
obvious kinds of errors (invalid characters, wrong or missing port
number).
2014-06-24 14:33:38 +02:00
Pieter Hintjens
1f063dc30a Merge pull request #1103 from ricnewton/master
Fix windows build
2014-06-23 20:23:20 +02:00
Richard Newton
82be399527 Merge pull request #1097 from hintjens/master
Added capabilities API
2014-06-23 13:23:20 +01:00
Richard Newton
369725ab8f Fix windows build 2014-06-23 13:10:43 +01:00
Martin Hurton
b73d1c8fed Fix memory leak in socks connecter 2014-06-23 00:02:15 +02:00
Pieter Hintjens
79d578ef0b Merge pull request #1100 from hurtonm/master
Add support for SOCKS proxies
2014-06-22 23:42:23 +02:00
Martin Hurton
f06ca69ae9 Add support for SOCKS proxies
This is still raw and experimental.
To connect through a SOCKS proxy, set ZMQ_SOCKS_PROXY socket option on
socket before issuing a connect call, e.g.:

    zmq_setsockopt (s, ZMQ_SOCKS_PROXY,
        "127.0.0.1:22222", strlen ("127.0.0.1:22222"));
    zmq_connect (s, "tcp://127.0.0.1:5555");

Known limitations:
- only SOCKS version 5 supported
- authentication not supported
- new option is still undocumented
2014-06-22 23:19:33 +02:00
chrox
bdf6427a00 Fixed build with arm-linux-androideabi toolchain 2014-06-22 18:13:05 +08:00
Pieter Hintjens
f11d673ba9 Problem: need way to probe library capabilities
As libzmq is compiled with optional transports and security mechanisms,
there is no clean way for applications to determine what capabilities
are actually available in a given libzmq instance.

Solution: provide an API specifically for capability reporting. The
zmq_has () method is meant to be open ended. It accepts a string so
that we can add arbitrary capabilities without breaking existing
applications.

zmq.h also defines ZMQ_HAS_CAPABILITIES when this method is provided.
2014-06-18 15:19:07 +02:00
Pieter Hintjens
27547bc9bc Problem: when libgssapi isn't available, GSSAPI options 'seem' to work
Solution: use same approach as for libsodium/CURVE, i.e. return EINVAL
if the library isn't present when libzmq builds, and the application
still tries to use these options in zmq_getsockopt/setsockopt.
2014-06-17 16:32:47 +02:00
Pieter Hintjens
1beb54cef0 Added militant API checking on zmq_getsockopt 2014-06-17 16:24:56 +02:00
Pieter Hintjens
d0667461f0 Fixed build: malformed only defined when needed. 2014-06-17 16:14:19 +02:00
Pieter Hintjens
b4ed3f5506 Problem: API violations are treated as recoverable errors
The example is applications passing invalid arguments to a socket option
and then failing to check the return code. The results can be very hard
to diagnose. Here are some threads that show the pain this causes:

* https://github.com/zeromq/zyre/issues/179
* http://lists.zeromq.org/pipermail/zeromq-dev/2014-June/026388.html

One common argument is that a library should never assert, and should
pass errors back to the calling application. The counter argument is
that when an application is broken enough to pass garbage to libzmq,
it cannot be trusted to handle the resulting errors properly. Empirical
evidence from CZMQ, where we systematically assert on bad arguments, is
that this militant approach makes applications more, not less, robust.

I don't see any valid use cases for returning errors on bad arguments,
with one exception: zmq_setsockopt can be used to probe whether libzmq
was e.g. built with CURVE security. I'd argue that it's nasty to use a
side effect like this. If apps need to probe how libzmq was built, this
should be done explicitly, and for ALL build options, not just CURVE.

There are/were no libzmq test cases that check the return code for an
invalid option.

For now I've enabled militant assertions using --with-militant at
configure time. However I'd like to make this the default setting.
2014-06-17 16:00:55 +02:00
Richard Newton
1d236d81c8 Merge pull request #1090 from hintjens/master
Problem: zmq_ctx_get (ZMQ_MAX_SOCKETS) returns gibberish
2014-06-16 08:45:37 +01:00
Martin Hurton
b62d1c7d5f Code cleanup 2014-06-15 19:45:09 +02:00
Pieter Hintjens
39455c2114 Problem: zmq_ctx_get (ZMQ_MAX_SOCKETS) returns gibberish
Well, not gibberish, but 2^31 on Linux, which is useless. The code
should probably use getrlimit on Linux and other calls depending on
the system. For now I've set the ceiling at 64K.
2014-06-11 18:24:39 +02:00
Jan Kryl
cc4c37dc62 program dumps core when getpeername() returns EINVAL (#1085) 2014-06-10 16:11:00 -04:00
Olaf Mandel
ab5775fb00 Fix failed assertion for WSAENOTSOCK
In de9eef306, the error number assigned to WSAENOTSOCK was EFAULT, but
zmq.cpp:919 expects an ENOTSOCK in this case.
2014-06-10 14:45:04 +02:00
Martin Hurton
706eb4da8d Code cleanup 2014-06-07 23:05:45 +02:00
Matthias Kluwe
fa95d0b5e8 removed whitespace
(accidentially used my preferred style)
2014-06-05 19:39:15 +02:00