Commit Graph

55 Commits

Author SHA1 Message Date
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
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
Frederic Tregon
625b618776 Fixed ZMQ_REQ_CORRELATE (see pull request #1730)
Problem: Since pull request #1730 was merged, protocol for REQ socket is
checked at the session level and this check does not take into account
the possibility of a request_id being part of the message. Thus the option
ZMQ_REQ_CORRELATE would no longer work.
This is now fixed: the possiblity of a 4 bytes integer being present
before the delimiter frame is taken into account (whether or not this
breaks the REQ/REP RFC is another issue).
2016-04-02 18:36:29 +02: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
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
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01: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
Martin Hurton
a80fb34765 Fix some comments regarding method overriding 2014-01-08 18:29:35 +01:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Christian Kamm
423ca36b17 Rename ZMQ_REQ_SEND_RESETS -> ZMQ_REQ_STRICT.
It defaults to enabled. Switch it off to be able to send a new message
before the previous reply has been received.
2013-08-03 14:35:18 +02:00
Christian Kamm
f5c59556bd REQ: Unset reply_pipe if it terminates.
* Fixes a terminate() call on a dangling pointer in the SEND_RESETS
  case.
* Fixes recv_reply_pipe() never receiving a message once the pipe it is
  waiting on is terminated.
2013-07-29 09:35:15 +02:00
Christian Kamm
a0cc87a9d9 Add ZMQ_REQ_SEND_RESETS option.
This allows making a new request on a REQ socket by sending a new
message. Without the option set, calling send() after the first message
is done will continue to return an EFSM error.

It's useful for when a REQ is not getting a response. Previously that
meant creating a new socket or switching to DEALER.
2013-07-28 11:43:38 +02:00
Christian Kamm
b9646f2aac Add ZMQ_REQ_REQUEST_IDS option.
* Documentation:
The default behavior of REQ sockets is to rely on the ordering of messages
to match requests and responses and that is usually sufficient. When this option
is set to 1, the REQ socket will prefix outgoing messages with an extra frame
containing a request id. That means the full message is (request id, 0,
user frames...). The REQ socket will discard all incoming messages that don't
begin with these two frames.

* Behavior change: When a REQ socket gets an invalid reply, it used to
  discard the message and return EAGAIN. REQ sockets still discard
  invalid messages, but keep looking at the next one automatically
  until a good one is found or there are no more messages.
* Add test_req_request_ids.
2013-07-26 21:38:21 +02:00
Christian Kamm
c56d797bf9 REQ sockets drop replies from unasked peers.
* Add lb_t::sendpipe() that returns the pipe that was used for sending,
  similar to fq_t::recvpipe().
* Add forwarder functions to dealer_t to access these two.
* Add logic to req_t to ignore replies on pipes that are not the one
  where the request was sent.
* Enable test in test_spec_req.
2013-07-14 07:55:47 +02:00
Martin Hurton
fd7e9b8c46 Use generic session class whenever possible 2013-06-29 11:27:03 +02:00
Martin Hurton
7942db7606 Refactor code so that messages go through engines 2013-04-11 18:52:51 +02:00
Pieter Hintjens
f0f16505e5 Removed corporate advertisements from source file headers
Copyrights had become ads for Sustrik's corporate sponsors, going against the original
agreement to share copyrights with the community (that agreement was: one line stating
iMatix copyright + one reference to AUTHORS file). The proliferation of corporate ads
is also unfair to the many individual authors. I've removed ALL corporate title from
the source files so the copyright statements can now be centralized in AUTHORS and
source files can be properly updated on an annual basis.
2013-03-12 13:24:57 +01:00
Martin Hurton
66dc4d8b54 Don't pass flags to xrecv method 2012-11-09 17:18:14 +01:00
Martin Hurton
7865f96e97 Don't pass flags to xsend method 2012-11-09 17:18:10 +01:00
Martin Hurton
dfc0222ee6 Decouple encoder_t and decoder_t from session_base_t
This patch introduces i_msg_sink and i_msg_source interfaces. This
allows us to make message encoder and decoder more general.
2012-09-02 22:46:26 +02:00
Martin Hurton
7fe45af30f Fix issue #370
The patch extends the internal session's API with the reset method.
This method is used to reset a session's state so that it can
handle a new connection.
2012-05-29 22:10:51 +02:00
Pieter Hintjens
c12fedc70a Completed internal renaming of XREP/XREQ to ROUTER/DEALER 2012-03-22 11:36:19 -05:00
Pieter Hintjens
6e71a54b1e Fixed issues #337, #341, and #340
* Implemented new ctx API (_new, _destroy, _get, _set)
* Removed 'typesafe' macros from zmq.h
* Added support for MAX_SOCKETS (was tied into change for #337)
* Created new man pages
2012-03-19 19:41:20 -05:00
Staffan Gimåker
b9fb48f47b Resolve addresses in the calling thread on connect.
This allows us to actually report an error to the caller on resolve
failure, rather than asserting later on in the io thread.

Signed-off-by: Staffan Gimåker <staffan@spotify.com>
2012-02-16 14:42:55 +01:00
AJ Lewis
c79abee6bc Get AIX 6.1 compiling again by making msg_t class explicit
Older versions of gcc have problems with in-line forward declarations
when there's a naming conflict with a global symbol.

Signed-off-by: AJ Lewis <aj.lewis@quantum.com>

Expand the original patch to all such forward declarations.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-09 15:22:20 +01:00
Martin Sustrik
a4843b65d2 Identities re-introduced
However, the "durable socket" behaviour wasn't re-added.
Identities are used solely for routing in REQ/REP pattern.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-04 08:00:47 +01:00
Martin Sustrik
8e21d64c97 Copyright dates adjusted to reflect reality
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 18:06:11 +01:00
Martin Sustrik
7842c71073 LABELS and COMMANDs removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 13:39:54 +01:00
Martin Sustrik
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
06bdf2c4f9 Check message syntax in REQ asynchronously
This patch adds support for checking messages as they arrive
(as opposed to when they are recv'd by the user) and drop
the connection if they are malformed.

It also uses this new feature to check for validity of inbound
messages in REQ socket.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-16 09:29:43 +02:00
Martin Sustrik
f78d9b6bfc Session class separated into socket-type-specific sessions
This is a preliminary patch allowing for socket-type-specific
functionality in the I/O thread. For example, message format
can be checked asynchronously and misbehaved connections dropped
straight away.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-15 10:00:23 +02:00
Martin Sustrik
ec81f8fb25 New wire format for REQ/REP pattern
This patch introduces two changes:
1. 32-bit ID is used to identify the peer instead of UUID
2. REQ socket seeds the label stack with unique 32-bit request ID
   It also drops any replies with non-matching request ID

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-22 11:02:16 +02:00
Martin Sustrik
e0246e32d7 Message-related functionality factored out into msg_t class.
This patch addresses serveral issues:
1. It gathers message related functionality scattered over whole
   codebase into a single class.
2. It makes zmq_msg_t an opaque datatype. Internals of the class
   don't pollute zmq.h header file.
3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33%
   of memory in scenarios with large amount of small messages.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-21 22:27:48 +02:00
Martin Sustrik
18b9ebea32 The copyrights in file headers updated.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02 16:30:40 +01:00
Martin Sustrik
18f29ded6a Make cppcheck not complain about "'operator=' should return something"
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-13 11:44:23 +01:00
Martin Sustrik
9cfdb441f4 slots renamed to tids
Threads were so far identified by integers called 'slots'.
This patch renames them to more comprehensible 'tid's (thread IDs).

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-05 16:38:52 +01:00
Martin Sustrik
b358df9fff Name of "GNU Lesser Public License" corrected.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30 15:08:28 +02:00
Martin Sustrik
3e97c0fef4 REQ socket implementation is layered on top of XREQ 2010-08-25 15:39:20 +02:00
Martin Sustrik
05d908492d WIP: Socket migration between threads, new zmq_close() semantics
Sockets may now be migrated between OS threads; sockets may not be used by
more than one thread at any time. To migrate a socket to another thread the
caller must ensure that a full memory barrier is called before using the
socket from the target thread.

The new zmq_close() semantics implement the behaviour discussed at:

http://lists.zeromq.org/pipermail/zeromq-dev/2010-July/004244.html

Specifically, zmq_close() is now deterministic and while it still returns
immediately, it does not discard any data that may still be queued for
sending. Further, zmq_term() will now block until all outstanding data has
been sent.

TODO: Many bugs have been introduced, needs testing. Further, SO_LINGER or
an equivalent mechanism (possibly a configurable timeout to zmq_term())
needs to be implemented.
2010-08-25 15:39:20 +02:00
Martin Sustrik
2f219d7c28 ZMQ_TBC renamed to ZMQ_MORE 2010-03-27 21:25:40 +01:00
Martin Sustrik
06538fc117 multi-part messages work with REQ/REP sockets 2010-03-27 14:24:57 +01:00
Martin Sustrik
61ad236e95 ZMQ_NOFLUSH and zmq_flush obsoleted 2010-03-13 14:40:10 +01:00
Martin Hurton
923609b092 Implement flow control for ZMQ_REQ sockets 2010-03-12 11:07:39 +01:00
Martin Hurton
61ee6fae53 Implement flow control
This commit introduces the necessary changes necessary
for implementing flow control. None of the socket types
implements the flow control yet. The code will crash when
the flow control is enabled and the thw lwm is reached.

The following commits will add flow-control support for
individual socket types.
2010-03-12 11:07:38 +01:00
Martin Sustrik
b9caa319e2 Multi-hop REQ/REP, part XI., finalise the XREQ/XREP functionality 2010-02-16 18:30:38 +01:00
Martin Sustrik
4f6baf4dde Copyrights transferred from FastMQ to iMatix 2010-01-05 08:29:35 +01:00
Martin Sustrik
c98fd6bc3f ZMQII-25: Implement streamed request/reply 2009-11-24 11:23:10 +01:00
Martin Sustrik
cc631c4c66 ZMQII-18: Implement I/O multiplexing (first approximation) 2009-10-01 10:56:17 +02:00
Martin Sustrik
088a2db674 ZMQII-16: Change "struct zmq_msg_t" to "zmq_msg_t" in C binding 2009-09-23 10:22:54 +02:00