Commit Graph

59 Commits

Author SHA1 Message Date
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
4b832ea374 Revert the early dropping of request and replies for disconnected clients
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 15:56:39 +01:00
Martin Sustrik
8485a5e5a4 Assert fixed in XREP & ROUTER when sending to terminating pipe (issue 258)
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-28 08:03:14 +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
9fb9fea633 Improve error reporting in a minor way
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-03 07:40:49 +02:00
Martin Sustrik
c8e8f2a24c ZMQ_IDENTITY socket option removed
This patch simplifies the whole codebase significantly,
including dropping depedency on libuuid.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-15 11:24:33 +02:00
Martin Sustrik
52eaf600e5 Drop outbound messages in XREP socket when SNDHWM is reached
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-09 09:40:40 +02:00
Martin Sustrik
770d0bc77c Fix MSVC build
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-23 08:51:48 +02:00
Martin Sustrik
d1373792f7 Outstanding requests dropped when requester dies (issue 190)
So far the requests in req/rep pattern were delivered to and processed
by worker even though the original requester was dead. Thus,
the worker processing replies with noone to deliver results to.
This optimisation drops requests in two situations:

1. Queued inbound requests in XREP socket when peer disconnects.
2. Queued outbound requests in XREQ when socket is closed.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-23 07:57:47 +02:00
Martin Sustrik
12532c7940 O(1) fair-queueing in XREP implemented
Up to now the complexity of fair-queueing in XREP was O(n).

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-22 16:51:40 +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
ab99975ad4 LABEL flag added to the wire format
So far there was no distinction between message parts used by 0MQ
and message parts used by user. Now, the message parts used by 0MQ
are marked as 'LABEL'.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20 11:33:54 +02:00
Martin Sustrik
0f6f7276e3 Move the pipe termination code to socket_base_t
So far, the pipe termination code was spread among socket type
classes, fair queuer, load balancer, etc. This patch moves
all the associated logic to a single place.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-23 20:30:01 +02:00
Martin Sustrik
acf0b0e515 Introduces bi-directional pipes
So far, there was a pair of unidirectional pipes between a socket
and a session (or an inproc peer). This resulted in complex
problems with half-closed states and tracking which inpipe
corresponds to which outpipe.

This patch doesn't add any functionality in itself, but is
essential for further work on features like subscription
forwarding.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-22 17:26:53 +02:00
Martin Sustrik
49df2f416c Fixes warning when compiling with MSVC on Win64
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-15 13:12:09 +02:00
Pieter Hintjens
da1ef4d268 Fixed REP assert on missing envelope
Signed-off-by: Pieter Hintjens <ph@imatix.com>
2011-05-08 09:02:47 +02:00
Martin Sustrik
0c5b781e97 urrent pipe pointer in XREP out of range -- fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-06 15:51:56 +02:00
Tore Halvorsen
10120214ac Accessing an iterator after it is accessed is not valid.
Moving the erase after the access and check agains current_id.
2011-05-04 12:41:10 +02:00
Martin Sustrik
6ecec9bbf1 Current inpipe remains unchaged in XREP when other pipe terminates
When an inpipe terminated within XREP, it was erased from the array
and thus current_in (which is an index) pointed to a different
element in the array. This caused problems when we were in the
middle of reading a multipart message.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-02 19:28:51 +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
581697695a Message validity is checked in the runtime
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-19 08:08:15 +02:00
Jon Dyte
b79d07b8bc reset socket state when identity message cannot be written to xrep
Signed-off-by: Jon Dyte <jon@totient.co.uk>
2011-03-16 09:54:03 +01:00
Martin Sustrik
184bdb8e2b Bug caused by interaction of REQ/REP routing and HWM fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-03 12:37:11 +01: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
56bdba592c Fix cppcheck warnings: Prefer prefix ++/-- operators for non-primitive types.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-18 15:57:45 +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
0a03e86e95 ZMQ_LINGER socket option added.
1. ZMQ_LINGER option can be set/get
    2. options are part of own_t base class rather than being declared
       separately by individual objects
    3. Linger option is propagated with "term" command so that the
       newest value of it is used rather than the stored old one.
    4. Session sets the linger timer if needed and terminates
       as soon as it expires.
    5. Corresponding documentation updated.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-16 10:53:29 +02:00
Martin Sustrik
b7386f5b50 To insert to associateive STL containers value_type used instead of make_pair
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-14 12:13:52 +02:00
Martin Sustrik
f22e85f19f Reverting commit 1d431190f5
The patch was supposed to check that pipe writer sends messages
in atomic fashion. However, it prevented the user to read
half of a message and close the socket.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-11 12:23:18 +02:00
Martin Sustrik
73e7ef37c2 When XREP silently drops message, it does not empty it -- fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-10 09:23:37 +02:00
Martin Sustrik
7a685b0f88 Clean-up of session termination process
Specifically, shutdown of child objects is initiated *before* termination
handshake with socket object.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-08 17:23:21 +02:00
Nir Soffer
1d431190f5 make sure that reader does not terminate in the middle of a multipart message 2010-10-02 10:01:18 +02:00
Martin Sustrik
0bb76b667b assert when xrep socket gets reconnected in the middle of the shutdown -- fixed 2010-10-01 13:37:46 +02:00
Martin Sustrik
ac9b05c36b Merge branch 'maint'
* maint:
  zmq_msg_move called on uninitialised message in xrep_t::xrecv -- fixed
2010-09-30 15:12:06 +02:00
Max Wolf
79aea5ffa6 zmq_msg_move called on uninitialised message in xrep_t::xrecv -- fixed 2010-09-30 15:10:47 +02:00
Martin Sustrik
98fa2fa802 fix in XREP's fair queueing mechanism 2010-09-30 14:03:54 +02:00
Gonzalo Diethelm
87beaaa00d ZMQ_TYPE socket option added 2010-09-28 15:27:45 +02:00
Martin Sustrik
d13933bc62 I/O object hierarchy implemented 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
Pieter Hintjens
5be54b9120 46 - Devices vulnerable to invalid messages
http://github.com/zeromq/zeromq2/issues#issue/46
Invalid messages are now discarded silently, instead of causing an assertion
failure.
2010-08-11 17:05:19 +02:00
Martin Hurton
fd707fedc5 issue 38 - Assertion failed: fetched (xrep.cpp:196) 2010-07-07 12:41:53 +02:00
Martin Sustrik
acfd0f8ca2 prefix in XREP recv'd message misses MORE flag 2010-04-30 04:53:41 +02:00
Martin Sustrik
ad6fa9d0d4 initial version of multi-hop REQ/REP 2010-04-27 17:36:00 +02:00
Martin Sustrik
dfdaff5eba XREP-style prefixing/trimming messages removed 2010-03-20 10:58:59 +01:00
Martin Sustrik
61ad236e95 ZMQ_NOFLUSH and zmq_flush obsoleted 2010-03-13 14:40:10 +01:00
Martin Hurton
42e575cb6b Implement flow control fox ZMQ_XREP 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