Commit Graph

49 Commits

Author SHA1 Message Date
Michael Vilim
8a16fef3cc Problem: ZMQ_CONNECT_ROUTING_ID can be assigned to incoming socket connection (Issue #3191)
Solution: Add an identifier parameter for local attach to zmq::socket_base_t::attach_pipe
2018-07-26 18:26:35 -05:00
Simon Giesecke
5a343fc27b Problem: stream_t/router_t access data member of base class
Solution: pull up functionality to base class
2018-05-29 15:05:27 +02:00
Simon Giesecke
ab3895a470 Problem: duplicated code in stream_t & router_t
Solution: pulled up to routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
09fab930b3 Problem: xwrite_activated duplicated between stream_t and router_t
Solution: pull up into routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
c9d6ef3035 Problem: Member outpipes is duplicate between router_t and stream_t
Solution: extract into common base class routing_socket_base_t, for now as protected
2018-05-29 15:05:26 +02:00
Simon Giesecke
728eddfcfd Problem: socket_base_t::connect_routing_id is protected and only used in router_t and stream_t
Solution: add an intermediary base class routing_socket_base_t, move common functionality there and make connect_routing_id private
2018-05-29 15:05:26 +02:00
Simon Giesecke
e3c73d9881 Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
2018-05-27 13:24:07 +02:00
Simon Giesecke
4e616f30dd Problem: C-style casts used
Solution: replace by C++-style casts
2018-05-18 17:04:01 +02:00
Simon Giesecke
6f967c3a13 Problem: code duplication in getsockopt/setsockopt
Solution: extracted common code into do_getsockopt/do_setsockopt functions
2018-03-06 16:41:30 +01:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
Simon Giesecke
0897b3e07b Problem: excessive memory allocations around blob_t (#2796)
* Problem: excessive memory allocations around blob_t

Solution: redefine blob_t as a custom type, and use reference/move
semantics where possible
2017-10-21 12:19:51 +01:00
sigiesec
41bae55af7 Problem: inconsistent naming related to routing ids
Solution: renamed routing_id fields in pipe_t, renamed ZMQ_CONNECT_RID to ZMQ_CONNECT_ROUTING_ID
2017-09-19 17:53:53 +02:00
sigiesec
9e7507b38b Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-19 17:53:44 +02:00
Doron Somech
af03241dcb Revert "Problem: term "identity" is confusing" 2017-09-07 15:47:43 +03:00
sigiesec
e00131dd43 Problem: inconsistent naming related to routing ids
Solution: renamed routing_id fields in pipe_t, renamed ZMQ_CONNECT_RID to ZMQ_CONNECT_ROUTING_ID
2017-09-07 10:33:13 +02:00
sigiesec
1daf83079a Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-06 17:45:56 +02:00
Constantin Rack
022cf2aeaa Problem: source code contains tabs
Solution: replace tabes with spaces
2016-09-17 08:44:00 +02: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
Brian Silverman
273b54715e Use memcpy instead of assuming option values are aligned
Otherwise, it's undefined behavior. ubsan catches alignment issues in
the libzmq test suite without this.
2016-02-06 22:22:51 -05:00
Pieter Hintjens
27a8961c37 Problem: resolution of int optval_ was made more verbose
There's no value in this as the same pattern is repeated in several
places and it's fair to expect people to understand it.

Solution: revert to the old, one-liner style.
2016-02-06 14:12:43 +01:00
Brian Silverman
f4fe375bd1 Don't call memcpy with 0 size and NULL pointer(s)
It's undefined behavior, and ubsan flags it.
2016-02-05 14:04:22 -05:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Constantin Rack
bd923f0fbb Problem: some comments contain typos 2015-09-06 18:46:32 +02:00
Joe Eli McIlvain
33419425eb Problem: Private/internal macros defined in public header.
Solution: Move the macros to a private header.
2015-08-21 16:12:22 -07:00
reza.ebrahimi
63260d8701 rename ZMQ_UNUSED macro to LIBZMQ_UNUSED 2015-08-22 00:31:25 +04:30
reza.ebrahimi
bff2284a50 place a ZMQ_UNUSED macro and replace all unused variables with ZMQ_UNUSED macro 2015-08-14 15:40:39 +04:30
Brian Silverman
18791f2bfb Fix several missing msg_t::close calls.
I traced memory leaks found using AddressSanitizer down to these.
2015-07-21 19:42:20 -07:00
Pieter Hintjens
8620c3e032 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:33:55 +02:00
evoskuil
30bd7c481e Fix integer narrowing issues. 2015-04-21 22:26:32 -07:00
Thomas Rodgers
700f7bfede resolve #1347 addresses issue of no metadata on identity frame 2015-02-19 13:22:32 -06:00
Thomas Rodgers
638ddeb404 resolve #1347 Support limited metadata for STREAM sockets 2015-02-18 12:28:58 -06:00
evoskuil
6724f41427 Fix forcing to bool. 2015-02-11 13:09:25 -08:00
Pieter Hintjens
6ced7027a0 Problem: commit afb24b53 broke ZMQ_STREAM contract
Symptom is that ZMQ_STREAM sockets in 4.1.0 and 4.1.1 generate zero
sized messages on each new connection, unlike 4.0.x which did not do
this.

Person who made this commit also changed test cases so that contract
breakage did not show. Same person was later banned for persistently
poor form in CZMQ contributions.

Solution: enable connect notifications on ZMQ_STREAM sockets using a
new ZMQ_STREAM_NOTIFY setting. By default, socket does not deliver
notifications, and behaves as in 4.0.x.

Fixes #1316
2015-01-23 15:25:40 +01:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01: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
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
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
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
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Pieter Hintjens
eaba5dfe37 Renamed test_router_raw_empty to test_stream_empty
* The ZMQ_ROUTER_RAW API was deprecated in favor of ZMQ_STREAM
* Same issue hit router.cpp, which I've fixed
2013-10-28 21:00:42 +01:00
Shawn J. Goff
6a18f59532 Change name of icanhasall to subscribe_to_all
icanhasall is cute (for now), but the effect of the variable is clear
only after tracking down its origin reading the commit. This change is
intended to make it easier for people to have some intuition about its
effect from its name.
2013-08-31 10:02:05 -04:00
Martin Hurton
fd7e9b8c46 Use generic session class whenever possible 2013-06-29 11:27:03 +02:00
Martin Hurton
7b27c125dc Simplify ZMQ_STREAM socket implementation, part II 2013-06-28 11:24:14 +02:00
Martin Hurton
a1bb5e83ff Simplify ZMQ_STREAM socket implementation 2013-06-28 09:48:54 +02:00
Pieter Hintjens
ad77937956 Added ZMQ_STREAM socket type
- designed for TCP clients and servers
- added HTTP client / server example in tests/test_stream.cpp
- same as ZMQ_ROUTER + ZMQ_ROUTER_RAW + ZMQ_ROUTER_MANDATORY
- includes b893ce set ZMQ_IDENTITY on outgoing connect
- deprecates ZMQ_ROUTER_RAW
2013-06-27 20:53:15 +02:00