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

1754 Commits

Author SHA1 Message Date
bebopagogo
d3e0be1528 added uncommitted norm_engine changes 2014-03-16 09:15:31 -04:00
bebopagogo
33f22d0d04 added norm_engine 2014-03-15 10:48:12 -04:00
bebopagogo
c91a638a5a added norm_engine 2014-03-15 10:46:21 -04:00
Mark Barbisan
350a1ac12b Allow TCP addresses to be re-resolved whenever there is a reconnection attempt 2014-03-12 13:28:37 -04:00
Pieter Hintjens
305a1442ae Added scaffolding for zmq_msg_gets 2014-03-03 13:19:40 +01:00
Pieter Hintjens
8b7ac4ffdc Merge pull request #902 from pavel-pimenov/fix-pvs-studio-v547
Fix build with ZMQ_HAVE_WINDOWS (typedef UINT_PTR fd_t; -> unsigned type...
2014-02-21 11:02:20 +01:00
Pavel Pimenov
acfbfe53bc Fix build with ZMQ_HAVE_WINDOWS (typedef UINT_PTR fd_t; -> unsigned type)
V547 Expression 'file_desc >= 0' is always true. Unsigned type value is always >= 0. socket_base.cpp 845
  V547 Expression 'file_desc >= 0' is always true. Unsigned type value is always >= 0. socket_base.cpp 863
  V547 Expression 'file_desc >= 0' is always true. Unsigned type value is always >= 0. socket_base.cpp 897
  http://www.viva64.com/en/d/0137/print/
2014-02-21 13:22:53 +04:00
KIU Shueng Chuan
acf0949f18 workaround missing Mstcpip.h in mingw32 2014-02-18 21:24:24 +08:00
KIU Shueng Chuan
9d3d9d635a fix: win32 tcp_keepalive gets set even when option is -1 2014-02-18 14:17:32 +08:00
Pieter Hintjens
1879b8ba76 Merge pull request #899 from olafmandel/duplicate_poller_detect
Remove duplicate poller decision making
2014-02-17 16:07:31 +01:00
Olaf Mandel
48b50cefb4 Remove duplicate poller decision making
The decision about the poller mechanism to use (select, poll, ...)
was done twice: once by the build system and once by the code in
poller.hpp. As the build-system can actually detect the mechanisms
available, prefer that result to the hard coded defaults in
poller.hpp.

At the same time, remove the duplicate detection of select() vs.
poll()-variant from proxy.cpp, signaler.cpp and zmq.cpp.

This patch has not been tested on many build platforms: especially
the cmake build needs testing / patching. For the other builds,
hard code the result as these these are all Windows platforms.
2014-02-17 14:08:11 +01:00
Ian Barber
f789177abe Merge pull request #898 from hintjens/master
Added temporary CURVE debugging support
2014-02-17 11:18:51 +00:00
Pieter Hintjens
8cca4735d8 Added temporary CURVE debugging support
- just prints server-side failures to console
- can be improved over time, e.g. enabled at build time or
  sent to inproc debug channel
2014-02-16 20:19:46 +01:00
Olaf Mandel
e41c8cba0e Rename ZMQ_MAX_SOCKETS_MAX to ZMQ_SOCKET_LIMIT
As per suggestion by Pieter Hintjens. Also update wording in
zmq_ctx_set manual a bit.
2014-02-14 10:09:19 +01:00
Pieter Hintjens
1e9ea54bf6 Merge pull request #889 from olafmandel/MAX_SOCKETS_MAX
Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
2014-02-13 19:15:01 +01:00
Pieter Hintjens
af42d439cd Merge pull request #890 from brunoqc/880
Fix a strict-aliasing with type-punning
2014-02-13 19:13:04 +01:00
Laurent Alebarde
abf9d8b74e Revert "add a proxy hook"
This reverts commit 9ae6a91fadb96fd48038fde04cc3d4b61b49a8a1.
2014-02-13 18:35:09 +01:00
Laurent Alebarde
bc25366f7c Revert "add proxy_chain, a multi proxies chaining in the same thread feature"
This reverts commit bc7441f5176589ad9a34dc2bde6b91d78a44e3e0.
2014-02-13 18:35:09 +01:00
Bruno Bigras
e8a13c44b0 Fix a strict-aliasing with type-punning
Fixes #880
2014-02-13 12:06:10 -05:00
Olaf Mandel
5815b768b9 Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
The new options allows querying the maximum allowed number of sockets.
This is system dependent and cannot be encoded in the include file as a
preprocessor macro: for ZMQ_USE_SELECT, this depends on the FD_SETSIZE
macro at time of library compilation, not at time of include file use.
2014-02-13 15:54:06 +01:00
Pieter Hintjens
b54a168d41 Merge pull request #884 from guruofquality/cmake_fixes
fix libzmq.pc generation under cmake
2014-02-13 11:36:51 +01:00
Pieter Hintjens
c7ffef37bc Merge pull request #886 from guruofquality/auto_fixes
fix autotools out of tree build link issue on linux
2014-02-13 10:03:55 +01:00
Richard Newton
12442a3d65 Bind pending connections on terminate outside lock. 2014-02-12 23:45:39 +00:00
Richard Newton
668c42fc26 Fix hang on term when inproc is connected but never bound. 2014-02-12 23:10:23 +00:00
Josh Blum
a5741ea2f5 fix autotools out of tree build link issue on linux
added srcdir to --version-script=$(srcdir)/libzmq.vers
2014-02-12 11:22:37 -08:00
Josh Blum
b1471da5ac fix libzmq.pc generation under cmake
The ${libdir} was getting replaced/removed by configure_file() making pkg-config give bad flags: -L -lzmq
My fix was to add @ONLY to configure_file() so ${} style pkg-config substitutions are left alone.
In addition, I put the other typical ${} substitutions back into the libzmq.pc, since its now safe.
2014-02-11 15:46:38 -08:00
Pieter Hintjens
ab9349d3fe Revert "Fix potential memory leak"
This reverts commit 50d34e5653ade4f3f1623c86f1426aeb746ae564.
2014-02-11 18:30:08 +01:00
Martin Hurton
a09407829e Fix identity handling for inproc transport
Fixes #872
2014-02-09 21:02:00 +01:00
Alex Pyrgiotis
50d34e5653 Fix potential memory leak
Delete the socket if the initialization part of the socket creation
fails.
2014-02-03 18:03:25 +02:00
Alex Pyrgiotis
e6ef16d005 Fix potential segmentation fault
Call the allocation assertion macro before dereferencing the socket
pointer.
2014-02-03 17:35:53 +02:00
Pieter Hintjens
4f56631f78 Fixed issue #868 2014-02-03 11:16:49 +01:00
Pieter Hintjens
45b593e7ed Whitespace fix 2014-02-03 11:03:59 +01:00
Pieter Hintjens
40d7ca6a60 Whitespace cleanups 2014-02-03 11:03:59 +01:00
Richard Newton
1fe82ae0a4 Merge pull request #866 from hintjens/master
Fixed issue #865 - validation on ZMQ_TCP_KEEPALIVE
2014-01-31 03:14:08 -08:00
Pieter Hintjens
bb81b1e3d9 Fixed issue #865 - validation on ZMQ_TCP_KEEPALIVE 2014-01-31 12:03:15 +01:00
Pavel Pimenov
5dd82a6fa6 [libzmq] const string p -> const string& p (#860) 2014-01-29 15:58:53 +04:00
Laurent Alebarde
bc7441f517 add proxy_chain, a multi proxies chaining in the same thread feature 2014-01-28 18:15:01 +01:00
Laurent Alebarde
9ae6a91fad add a proxy hook 2014-01-24 16:52:30 +01:00
Pieter Hintjens
9c6aa1e9e0 Merge pull request #848 from Prarrot/master
Changed fail behavior of CONNECT_RID to an assert failure instead of silent failure.
2014-01-21 12:08:00 -08:00
Tim M
515af9b147 Added assert on duplicate id in ROUTER and STREAM sockets. Updated man to reflect this change. Modified test case to match. 2014-01-21 11:43:34 -08:00
Laurent Alebarde
5bc6737039 factorize code in proxy 2014-01-20 17:00:02 +01:00
Tim M
3fbc10eba7 Updated man entries, and added behavior in case the user duplicates peer ids. In this case the socket reverts to default behavior. 2014-01-19 17:28:13 -08:00
Tim M
1d9b76c860 Added test for ZMQ_CONNECT_RID 2014-01-19 15:59:43 -08:00
Tim M
2f36f65f8f Fixed duplicate variable declaration. 2014-01-19 15:05:20 -08:00
Pieter Hintjens
50bd28c037 Cleaned up option to force identity on outgoing connection
- renamed to ZMQ_CONNECT_RID
- fixed whitespace malformating around previous patch
- renamamed next_peer_id to next_rid in preparation for
  larger rename of IDENTITY to ROUTING_ID

Note: ZMQ_CONNECT_RID has no test case and no entry in the man
page, as yet.
2014-01-19 09:27:57 +01:00
Pieter Hintjens
5f07d103a7 Merge pull request #838 from Prarrot/master
Fixed compile issue with missing member of socket_base.  Changed ZMQ_NEX...
2014-01-19 00:09:15 -08:00
Tim M
b1920bdf90 Fixed compile issue with missing member of socket_base. Changed ZMQ_NEXT_IDENTITY to ZMQ_NEXT_CONNECT_PEER_ID.
Fixed case where ZMQ_NEXT_CONNECT_PEER_ID is used in ROUTER, and ROUTER does not read the identity message from the connected pipe.
2014-01-18 17:49:54 -08:00
Matt Arsenault
00aeaddf94 Fix unused parameter and variable warnings. 2014-01-18 13:17:29 -08:00
Pieter Hintjens
d82389a788 Merge pull request #834 from Prarrot/master
Updated STREAM and ROUTER sockets to allow for pre-naming of outbound connections
2014-01-17 23:13:07 -08:00
Pieter Hintjens
a66c47f995 Merge pull request #833 from mrvn/pull_store-fd-on-connect
Store socket FD after connect
2014-01-17 23:11:45 -08:00
Tim M
5d4860ea12 Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.
This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:

zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);

In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.

This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
2014-01-17 14:34:39 -08:00
Goswin von Brederlow
afb24b53e6 Add STREAM connect notification.
Adjust test cases to connection notification.
Increase error checking in test cases.
2014-01-17 23:31:51 +01:00
Goswin von Brederlow
92f8f244e2 Store socket FD after connect 2014-01-17 23:30:17 +01:00
Eric Cornelius
88a8be8231 Update pipe.cpp 2014-01-15 18:11:13 -05:00
Eric Cornelius
589fa57afa Corrects ypipe initialization when conflate is NOT enabled.
Fixes LIBZMQ-584
2014-01-15 18:08:45 -05:00
Andre Caron
17651b9276 Adds support for detecting ZMQ_STREAM disconnections.
When a ZMQ_STREAM socket connection is broken (intentionally, via `shutdown()`
or accidentally via client crash or network failure), there is no way for the
application to dertermine that it should drop per-connection data (such as
buffers).

This contribution makes sure the application receives a 0-length message to
notify it that the connection has been broken.  This is symmetric with the
process of closing the connection from within the application (where the
application sends a 0-length message to tell ZeroMQ to close the connection).

Conflicts:
	CMakeLists.txt
2014-01-14 17:20:46 -08:00
Richard Newton
bf06f3bb27 Define NOMINMAN to fix windows build. 2014-01-14 10:27:40 +00:00
Bruno D. Rodrigues
d38a0c43b6 use version-script only for ELF linux 2014-01-13 17:31:56 +00:00
Jeremy Tan
5efee6e0d5 Fix compilation on MinGW-w64 2014-01-13 18:38:59 +08:00
Martin Hurton
e46ec31209 Implement socket_base_t::get_credential member function
The get_credential () member function returns
credential for the last peer we received message for.
The idea is that this function is used to implement user-level API.
2014-01-13 00:40:27 +01:00
Ian Barber
5c4f3cc603 Merge pull request #817 from Debian/symbols
Only export zmq_* symbols
2014-01-12 08:35:05 -08:00
Alessandro Ghedini
245c75aad6 Fix timestamp counter on s390/s390x
Fixes #811
2014-01-12 12:31:40 +01:00
Alessandro Ghedini
27c050845c Only export zmq_* symbols 2014-01-12 12:30:45 +01:00
Martin Hurton
5d41d51ba5 Replace assert with zmq_assert 2014-01-08 21:11:54 +01:00
Martin Hurton
a80fb34765 Fix some comments regarding method overriding 2014-01-08 18:29:35 +01:00
Martin Hurton
d72ceb93be Make it explicit that the probe function doesn't modify passed message 2014-01-08 08:21:13 +01:00
Pieter Hintjens
629221889d Merge pull request #810 from sradomski/master
ZMQ_SRCFD docs and tests
2014-01-06 20:56:23 -08:00
Stefan Radomski
3aeaa6fab1 ZMQ_SRCFD docs and tests
Also moved the fd field from message content to message itself
2014-01-07 01:09:51 +01:00
Martin Hurton
96f5fddc45 Simplify ypipe_t and ypipe_base_t template parameters 2014-01-06 11:34:00 +01:00
Stefan Radomski
823b7ebeb0 Removed dead code 2014-01-06 10:33:58 +01:00
Stefan Radomski
f30fb8501e Expose remote FD via zmq_msg_get(&msg, ZMQ_SRCFD)
This patch allows client applications to retrieve the remote endpoint from a message that originated from a tcp socket
2014-01-06 10:31:42 +01:00
AJ Lewis
cd2827fb36 Fix LIBZMQ-576 - Revert "Merge pull request #510 from miniway/master"
This reverts commit f27eb67e1abb0484c41050e454404cce30647b63, reversing
changes made to a3ae0d4c16c892a4e6c96d626a7c8b7068450336.

https://zeromq.jira.com/browse/LIBZMQ-576

Conflicts:
	src/stream_engine.cpp

Conflicts were around additional defaults to the constructor after the
'terminating' default.  The additional defaults were left alone, and
the 'terminating' default was removed.
2014-01-02 11:05:39 -06:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Pieter Hintjens
ff45caabd1 Fixed copyrights on TIPC code
- corporate copyright statements sit in AUTHORS file
2014-01-02 11:54:13 +01:00
Pieter Hintjens
5bf96f64b0 Removed ZMQ_ZAP_IPC_CREDS option
- This seems redundant; is there a use case for NOT providing
  the IPC credentials to the ZAP authenticator?

- More, why is IPC authentication done via libzmq instead of ZAP?
  Is it because we're missing the transport type on the ZAP request?
2014-01-01 17:39:14 +01:00
Pieter Hintjens
3ad8c61190 Whitespace fixes 2014-01-01 15:36:47 +01:00
Pieter Hintjens
9d9592f830 Whitespace fixes
Minor layout fix

Whitespace fix
2014-01-01 15:36:33 +01:00
Wouter Overmeire
a5f4d823a5 fix doc typo 2013-12-24 15:00:43 +01:00
Alex Grönholm
b554757cf0 Fixed setting TCP keepalive parameters on Windows 2013-12-22 02:55:18 +02:00
Pieter Hintjens
bf3702395c Fixed wildcard IPC endpoint and added test case 2013-12-20 14:28:54 +01:00
Pieter Hintjens
62f3fdf3b7 Fixed indentation 2013-12-20 14:17:35 +01:00
Pieter Hintjens
8ba1311e34 Fixed use of deprecated tempnam 2013-12-19 21:06:32 +01:00
Trevor Bernard
10a6641ef2 Fix issue #788 - Only allow a single connect per endpoint for SUB, REQ, and DEALER sockets 2013-12-14 23:40:34 -04:00
KIU Shueng Chuan
7f22995e35 use mutex implementation if fixed signaler_port!=5905 2013-12-12 00:39:01 +08:00
Brandon Carpenter
a018ef5e86 Add support for extending ZAP request address with IPC peer credentials.
Another take on LIBZMQ-568 to allow filtering IPC connections, this time
using ZAP.  This change is backward compatible.  If the
ZMQ_ZAP_IPC_CREDS option is set, the user, group, and process IDs of the
peer process are appended to the address (separated by colons) of a ZAP
request; otherwise, nothing changes.  See LIBZMQ-568 and zmq_setsockopt
documentation for more information.
2013-12-06 14:28:44 -08:00
Brandon Carpenter
dc9b1309b9 Shortened ZMQ_IPC_ACCEPT_FILTER_[UGP]ID to ZMQ_IPC_FILTER_[UGP]ID. 2013-12-06 09:58:10 -08:00
Brandon Carpenter
af808203d7 Fix failing test case in test_filter_ipc.
Add explicit check for primary group.
2013-12-06 00:46:14 -08:00
Pieter Hintjens
f5b6bd70f3 Merge pull request #775 from pijyoi/master
use enum retired_fd instead of -1
2013-12-05 03:25:12 -08:00
KIU Shueng Chuan
fd8d6d471f use enum retired_fd instead of -1
using -1 causes a warning on Windows platform because SOCKET is unsigned.
2013-12-05 07:04:21 +08:00
Brandon Carpenter
2252322acc Add IPC accept filter socket options.
Adds ZMQ_IPC_ACCEPT_FILTER_{PID,UID,GID} socket options to add processs,
user, and group IDs to the IPC filter sets. Fixes LIBZMQ-568.
2013-12-04 14:23:13 -08:00
Brandon Carpenter
8662f44efa Intial IPC accept filter support.
Adds sets of process (Linux only), user, and group IDs for filtering
connections from peer processes over IPC transport.  If all of the
filter sets are empty, every connection is accepted.  Otherwise,
credentials for a connecting process are checked against the filter sets
and the connection is only accepted if a match is found.

This commit is part of LIBZMQ-568 and only adds the filter sets and
implements the filter in the IPC accept method.  The interface for
adding IDs to filter sets are included in a separate commit.

IPC accept filtering is supported only on Linux and OS X.
2013-12-04 14:12:29 -08:00
Martin Hurton
973d13d545 Code cleanup 2013-12-03 15:59:34 +01:00
Brian Knox
ff292d62d0 changing zmq_proxy_steerable to not use null terminated strings 2013-12-01 20:29:03 +00:00
Martin Hurton
cf14c54102 Fix issue #763 2013-11-30 21:25:18 +01:00
KIU Shueng Chuan
bd41087ab9 make win32 signaler support ephemeral ports 2013-11-28 18:25:28 +08:00
Richard Newton
abbe704d9e Fix windows build for type of service. 2013-11-25 09:25:23 +00:00
Chris Laws
38bceca9ca Add ability to set and get DSCP socket option 2013-11-25 13:31:21 +10:30
KIU Shueng Chuan
7bd0b6ada1 remove all asserts during critical section
the size of the critical section is reduced by only entering the critical
section right before the bind().
2013-11-12 01:12:24 +08:00
KIU Shueng Chuan
cf8ba925b4 return error to caller on bind error 2013-11-12 00:07:06 +08:00
Ian Barber
51fa803d63 Merge pull request #751 from psl-felipefarinon/master
Removing C++11 code.
2013-11-11 05:51:12 -08:00