Commit Graph

185 Commits

Author SHA1 Message Date
Martin Sustrik
ba67eff167 non-immediate_connect functionality removed
It was used only by ROUTER socket. After its removal it became
obsolete.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-15 08:26:29 +02:00
Martin Sustrik
e4f98d1e10 ROUTER and DEALER sockets removed
To be replaced by new generic socket type

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-15 08:16: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
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
a28928fe37 Introduce ZMQ_ROUTER and ZMQ_DEALER sockets
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20 13:36:18 +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
8440de2b14 Fix minor warning in MSVC build
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20 08:11:48 +02:00
Fabien Ninoles
d7923f08ca Add sockopt ZMQ_RCVTIMEO/ZMQ_SNDTIMEO.
- Add doc and tests
- Add options and setup
- Wait using poll/select

Signed-off-by: Fabien Ninoles <fabien@tzone.org>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-17 12:22:02 +02:00
Martin Sustrik
a24a7c15a8 Session termination induced by socket fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-31 14:36:51 +02:00
Martin Sustrik
0b59866a84 Patches from sub-forward branch incorporated
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-30 10:07:34 +02:00
Martin Sustrik
87a6490b39 All pipe termination code moved to pipe_t
Till now the code was spread over mutliple locations.
Additionally, the code was made more formally correct,
with explicit pipe state machine etc.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-25 10:25:51 +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
b2eb84f8ca Substantial simplification of uuid_t
The string format of UUID is not used in 0MQ. Further on,
it turns out that UUIDs have fixed microarchitecture-agnostic
binary layout (see RFC4122). Thus, the conversion to string
and back to binary can be avoided.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-29 07:19:22 +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
Martin Sustrik
b96fe15bb6 Run-time checking for context & socket validity added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-09 09:35:34 +02:00
Martin Sustrik
abb184a051 ZMQ_NOBLOCK renamed ZMQ_DONTWAIT
Done because of POSIX compliance

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-26 10:38:40 +01:00
Martin Sustrik
bc4a1ce334 ZMQ_HWM split into ZMQ_SNDHWM and ZMQ_RCVHWM
These new options allow to control the maximum size of the
inbound and outbound message pipe separately.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 16:47:33 +01:00
Martin Sustrik
507718ee1a ZMQ_HWM type changed to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 15:43:03 +01:00
Martin Sustrik
d61f067f5b ZMQ_EVENTS type changed to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 15:07:23 +01:00
Martin Sustrik
23bd3726a5 ZMQ_RCVMORE type changed to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 14:59:43 +01:00
Martin Sustrik
8463b4d55e SWAP functionality removed
On-disk storage should be implemented in devices rather than
in 0MQ core. 0MQ is a networking library and there's no point
in storing network buffers on disk.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 12:27:06 +01:00
Martin Sustrik
32ded2b457 Duplicate identities now checked with zmq_connect
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-16 13:26:23 +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
4c7446211a Explicit identities bug in inproc transport fixed.
The identity of bound socket was not used. Instead, transient
identity was generated.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-01 16:08:40 +01:00
Martin Sustrik
d4e418f5f4 Socket with no owner objects is deallocated immediately
Till now the deallocation of such socket was delayed
till zmq_term() thus creating a "leak".

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-25 08:58:01 +01:00
Martin Sustrik
43e8868875 Added explicit error message in case of memory exhaustion
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-22 16:23:36 +01:00
Martin Sustrik
5b82b1ba30 Reaper thread waits for commands rather them retrieving them periodically
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-09 22:23:21 +01:00
Martin Sustrik
80ac398bba Initial implementation of reaper thread.
Reaper thread destroys the socket asynchronously.
zmq_term() can be interrupted by a signal (EINTR).
zmq_socket() will return ETERM after zmq_term() was called.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-09 15:32:15 +01:00
Martin Sustrik
1b15eba9a9 Fixed the problem of subscription forwarding and PGM interaction
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-28 07:50:21 +01:00
Martin Sustrik
bd0ba6e89a Size of inproc hwm and swap is sum of peers' hwms and swaps
The meat of the patch was contributed by Douglas Creager.
Martin Sustrik implemented storing peer options in inproc
endpoint repository.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-10 13:53:30 +01:00
Martin Sustrik
472bdcd6b4 Return ETERM from getsockopt(ZMQ_EVETS) if zmq_term() was called
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-05 16:57:51 +01:00
Dhammika Pathirana
f749f2d21c add basic uri validations
Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
2010-12-13 15:40:26 +01:00
Martin Sustrik
c80e7b80cc XPUB and XSUB socket types added.
These are just placeholders. At the moment XPUB behaves th same
as PUB and XSUB as SUB.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-12-04 23:14:38 +01:00
Martin Sustrik
8abe67357a Merge branch 'maint'
* maint:
  Fix socket_t::recv() hang scenario where initial call to process_commands() eats signal

Conflicts:
	src/socket_base.cpp
2010-11-12 14:47:26 +01:00
Marc Rossi
f7123de943 Fix socket_t::recv() hang scenario where initial call to process_commands() eats signal
Added block boolean var to second process_commands() invocation for blocking sockets
instead of always using true.  This prevents the process_commands() call from hanging
when a message is received with an empty queue after the call to xrecv() but
prior to the initial call to process_commands() invoked when ++ticks == inbound_poll_rate.

Signed-off-by: Marc Rossi <mrossi19@gmail.com>
2010-11-12 14:38:25 +01:00
Martin Sustrik
9da84a5239 signaler renamed to mailbox
For historical reasons queue to transfer commands between
threads was called 'signaler'. Given that it was used to
pass commands rather than signals it was renamed to 'mailbox',
see Erlang mailboxes.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-05 17:39:51 +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
5dae27d0ed clock_t class added 2010-09-26 16:55:54 +02:00
Martin Sustrik
7d5061798c Merge branch 'maint'
* maint:
  if TSC jumps backwards (in case of migration to a different CPU core) latency peak may occur -- fixed

Conflicts:
	src/app_thread.cpp
2010-09-26 13:36:05 +02:00
Martin Sustrik
9c11886600 The flag in the socket has clear semantics now -- it tracks whether corresponding context was closed, it doesn't track whether zmq_close was called on the socket itself 2010-09-21 09:00:46 +02:00
Martin Sustrik
0c215fada4 potential duplicate termination of pipes removed 2010-09-18 06:42:46 +02:00
Martin Sustrik
a68e6739f4 when no I/O threads are available error is raised instead of assertion 2010-09-09 08:25:00 +02:00
Martin Sustrik
91ea204644 EINTR returned from the blocking functions 2010-09-08 08:39:27 +02:00
Martin Sustrik
651c1adc80 sys transport introdced; inproc://log moved to sys://log 2010-09-01 15:24:46 +02:00
Martin Sustrik
fba90af8a7 Issue 54 - socket_base.cpp:162 comparison error 2010-08-30 12:10:40 +02:00
Martin Sustrik
42000d2c4f terminology unified: revive->activate 2010-08-28 10:15:03 +02:00
Martin Sustrik
92923cd40b bug in pipe deactivation fixed 2010-08-28 08:44:12 +02:00
Martin Sustrik
b608c19c5a MSVC build fixed 2010-08-25 15:39:21 +02:00
Martin Sustrik
9b8993efb4 elementary fixes to the named session 2010-08-25 15:39:21 +02:00
Martin Sustrik
43e34d0281 engine leak fixed; pgm compilation fixed 2010-08-25 15:39:20 +02:00
Martin Sustrik
45f83d78a5 one more dezombification bug fixed 2010-08-25 15:39:20 +02:00
Martin Sustrik
936dbf956b dezombification procedure fixed 2010-08-25 15:39:20 +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
Martin Hurton
ca057c7db8 Fix identity generation for transient inproc connections 2010-07-10 23:02:50 +02:00
Martin Hurton
fca2e8e8cc Add SWAP support 2010-06-21 15:06:51 +02:00
Martin Sustrik
9151de3895 generate identity for transient inproc connections 2010-06-17 11:01:18 +02:00
Brian Buchanan
ac90b7e0ba issue 35 - ZMQ_RCVMORE sometimes erroneously returns false 2010-06-11 08:03:34 +02:00
Martin Sustrik
8408ae066d LWM is computed rather than explicitly specified by user 2010-05-25 15:03:57 +02:00
Martin Sustrik
835e893e54 dispatcher_t class renamed to ctx_t 2010-05-05 14:24:54 +02:00
Martin Sustrik
fba28c7c0c issue 1 - Change zmq_term semantics 2010-04-11 16:36:27 +02:00
Martin Sustrik
00cf3ceb8d multi-part message functionality available via ZMQ_SNDMORE and ZMQ_RCVMORE 2010-04-11 10:26:47 +02:00
Martin Sustrik
716f4ac871 zmq_getsockopt function added 2010-04-09 13:04:15 +02:00
Martin Sustrik
2f219d7c28 ZMQ_TBC renamed to ZMQ_MORE 2010-03-27 21:25:40 +01:00
Martin Sustrik
842b4dd2e4 muti-part message functionality available via API 2010-03-27 14:57:56 +01:00
Martin Sustrik
61ad236e95 ZMQ_NOFLUSH and zmq_flush obsoleted 2010-03-13 14:40:10 +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 Lucina
27e2d08449 Restructure language bindings
C and C++ headers moved from bindings/ to include/, bindings/ removed
--with-c and --with-cpp options to configure removed, C and C++ now built
and installed by default
2010-03-11 20:33:27 +01:00
Martin Sustrik
d790940fd0 udp transport renamed to epgm 2010-03-09 18:14:49 +01:00
Martin Sustrik
aff1f6621a Merge branch 'master' of git@github.com:sustrik/zeromq2 2010-02-19 15:25:05 +01:00
Martin Sustrik
d008637bc4 one more attempt to fix the previous win32 problem 2010-02-17 21:16:59 +01:00
Martin Sustrik
e385319e5a recv returning -1 while errno=0 fixed 2010-02-17 20:33:00 +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
43620b3d35 Multi-hop REQ/REP, part X., optional delayed creation of pipes during connect 2010-02-14 13:34:48 +01:00
Martin Sustrik
4405250d93 Multi-hop REQ/REP, part IX., pass the peer identity as far as socket_base_t 2010-02-13 15:30:03 +01:00
Martin Sustrik
f5ce81f289 Multi-hop REQ/REP, part VIII., new blob_t type used for holding identity 2010-02-13 14:07:30 +01:00
Martin Sustrik
cdc2efe9b5 Multi-hop REQ/REP, part VII., identity-related algorithms rewritten 2010-02-13 13:07:33 +01:00
Martin Hurton
dc8f4b1b76 Fix memory leak in bind() 2010-02-12 15:20:43 +01:00
Martin Hurton
cd7300fd4f Resolve command starvation in recv() 2010-02-12 12:53:19 +01:00
Martin Sustrik
427bc3276a minor code cleanup 2010-02-07 16:24:14 +01:00
Martin Sustrik
2bb57ac57a ZMQII-39: Implement IPC transport 2010-01-15 14:11:39 +01:00
Martin Sustrik
067ba3b9f7 ZMQII-34: ensure that poll won't return POLLIN event when the message will be filtered out anyway (POSIX) 2010-01-13 19:21:23 +01:00
Martin Sustrik
4f6baf4dde Copyrights transferred from FastMQ to iMatix 2010-01-05 08:29:35 +01:00
Martin Sustrik
72161fb075 format of subscriptions changed (no * needed anymore) 2009-12-28 21:29:31 +01:00
Martin Sustrik
aebff623f3 ZMQII-28: Bidirectional introduction on TCP connection establishment 2009-12-23 19:37:56 +01:00
Martin Sustrik
8aa0908635 all news converted to nothrow variant 2009-12-15 23:49:55 +01:00
Martin Sustrik
7146ef85e9 seqnum mechanism automated 2009-12-02 21:26:47 +01:00
Martin Sustrik
9bd309bda6 annoying optimisation in 'bind' command removed 2009-12-01 18:50:54 +01:00
Martin Sustrik
c41daca3da race condition in inproc transport shutdown fixed 2009-11-21 21:30:09 +01:00
Martin Sustrik
64634605b3 obsolete parameter removed from 'bind' command 2009-11-21 21:13:29 +01:00
Martin Sustrik
0e9ab2e8a3 inproc transport - initial commit 2009-11-21 20:59:55 +01:00
Martin Sustrik
cc631c4c66 ZMQII-18: Implement I/O multiplexing (first approximation) 2009-10-01 10:56:17 +02:00
malosek
cf6cc0128f pgm2 receiver working (partly) 2009-09-25 17:50:12 +02:00
malosek
33afdcd1ad added --with-pgm2 into build system 2009-09-24 12:43:35 +02:00