Commit Graph

69 Commits

Author SHA1 Message Date
Pieter Hintjens
309740e197 Fixed issue #499 2013-01-31 20:47:45 +01:00
Pieter Hintjens
79da450b8b Fixed formatting in man page 2012-10-31 04:35:15 +01:00
Ian Barber
e5904e63ce Allow blocking while connect() is completing
This patch, salvaged from a trainwreck accidental merge earlier, adds a
new sockopt, ZMQ_DELAY_ATTACH_ON_CONNECT which prevents a end point
being available to push messages to until it has fully connected, making
connect work more like bind. This also applies to reconnecting sockets,
which may cause message loss of in-queue messages, so it is sensible to
use this in conjunction with a low HWM and potentially an alternative
acknowledgement path.

Notes on most of the individual commits can be found the repository log.
2012-06-12 15:34:48 +01:00
Ian Barber
95cbad3841 Revert "After speaking with Ben Gray and the discussion on the mailing list, this is an attempt to create a sockopt to allow connecting pipes to not immediately be available for traffic. The problem is in a PUSH to many PULL situation, where there is a connect to a PULL which is not there. This connect will immediately create a pipe (unlike bind), and traffic will be load balanced to that pipe. This means if there is a persistently unavailable end point then the traffic will queue until HWM is hit, and older messages will be lost."
This reverts commit fe3fb419fe.
2012-06-12 14:53:57 +01:00
Ian Barber
fe3fb419fe After speaking with Ben Gray and the discussion on the mailing list, this is an attempt to create a sockopt to allow connecting pipes to not immediately be available for traffic. The problem is in a PUSH to many PULL situation, where there is a connect to a PULL which is not there. This connect will immediately create a pipe (unlike bind), and traffic will be load balanced to that pipe. This means if there is a persistently unavailable end point then the traffic will queue until HWM is hit, and older messages will be lost.
This patch adds a sockopt ZMQ_DELAY_ATTACH_ON_CONNECT, which if set to 1 will attempt to preempt this behavior. It does this by extending the use of the session_base to include in the outbound as well as the inbound pipe, and only associates the pipe with the socket once it receives the connected callback via a process_attach message. This works, and a test has been added to show so, but may introduce unexpected complications. The shutdown logic in this class has become marginally more awkward because of this, requiring the session to serve as the sink for both pipes if shutdown occurs with a still-connecting pipe in place. It is also possible there could be issues around flushing the messages, but as I could not directly think how to create such an issue I have not written any code with regards to that.

The documentation has been updated to reflect the change, but please do check over the code and test and review.
2012-06-01 17:58:19 +01:00
Lourens Naudé
04f0e7f26e Documentation for zmq_monitor 2012-05-22 20:08:02 +01:00
Lourens Naudé
e13b3723b8 Rename type zmq_monitor_fn -> zmq_monitor for a more natural callback definition API (zmq_monitor type, monitor.function callback) 2012-05-20 18:27:59 +01:00
KennyTM~
c995de6584 Allow the ZMQ_MONITOR code compilable on gcc 4.7 on Linux.
The current ZMQ_MONITOR code does not compile in gcc 4.7, as -pedantic
and -Werror are enabled, and ISO C++ doesn't allow casting between
normal pointers (void*) and function pointers, as pedantically their
size could be different. This caused the library not compilable. This
commit workaround the problem by introducing one more indirection, i.e.
instead of calling

    (void *)listener

which is an error, we have to use

    *(void **)&listener

which is an undefined behavior :) but works on most platforms

Also, `optval_ = monitor` will not set the parameter in getsockopt(),
and the extra casting caused the LHS to be an rvalue which again makes
the code not compilable. The proper way is to pass a pointer of function
pointer and assign with indirection, i.e. `*optval_ = monitor`.

Also, fixed an asciidoc error in zmq_getsockopt.txt because the `~~~~`
is too long.
2012-05-13 20:49:05 +08:00
Lourens Naudé
5c6f72c17c ZMQ_MONITOR socket option registers a callback / event sink for changes in socket state 2012-05-04 02:32:46 +01:00
Ian Barber
b7c9fc0750 Slight tweak to text for readability 2012-04-27 11:22:17 +01:00
Paul Colomiets
138def0b99 Added refinement for ZMQ_FD option 2012-04-27 12:55:17 +03:00
Sergey KHripchenko
4315467d7c documentation trimmed down to be just placeholders for who knows english better than me 2012-04-09 13:39:52 +04:00
Sergey KHripchenko
4b303402a7 more flexible keepalive options detection + awful options documentation 2012-04-06 20:04:35 +04:00
Emmanuel Taurel
107581213c Disable reconnection option
Add value -1 to the ZMQ_RECONNECT_IVL to disable the reconnection algorithm
2012-03-20 09:22:27 +01:00
Ian Barber
5e1efc9ec3 Update documentation for last endpoint to mention inaddr_any and add a test for IPC last endpoint checking 2012-02-19 18:46:46 +00:00
Pieter Hintjens
5f6b95f4a2 Fixed footers to refer to man page, not all docs 2012-02-15 10:39:18 -06:00
Pieter Hintjens
2000d44109 Fixed syntax error in zmq_getsockopt man page 2012-02-15 09:26:39 -06:00
Ian Barber
cc10c00193 Updating docs with new sockopt 2012-02-14 23:14:33 +00:00
Martin Lucina
22ef966d4a Update email address in man pages
Signed-off-by: Martin Lucina <martin@lucina.net>
2011-12-18 11:19:55 +01:00
Martin Sustrik
f8bd3967bf Documentation for IPv4ONLY option clarified
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-16 19:49:31 +01:00
Martin Sustrik
d20ea25b8c ZMQ_IDENTITY option re-introduced
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-02 14:33:58 +01:00
Martin Sustrik
1c071f54a6 LABELs removed from the documentation
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 14:09:54 +01:00
Martin Sustrik
d31792e652 Default HWMs are set to 1000
This patch is meant to prevent users from running out of memory
when using 0MQ in the default configuration.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-06 13:12:49 +02:00
Pieter Hintjens
4138aca54b Fixed doc to clarify how label parts work
Signed-off-by: Pieter Hintjens <ph@imatix.com>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-03 09:02:56 +02:00
Steven McCoy
784041f5b9 ZMQ_IPV4ONLY option added
At this point option exists, is documented and can be set,
however, it has no effect.

Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08 12:10:31 +02:00
Martin Sustrik
1a40880552 ZMQ_IDENTITY option removed from the documentation
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-18 09:30:37 +02:00
Martin Sustrik
d7adc3f19a ZMQ_FILTER option removed
The filtering is now done depending on the socket type. SUB socket
filters the messages (end-to-end filtering) while XSUB relies
on upstream nodes to do (imprefect) filtering.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-11 09:57:59 +02:00
Martin Sustrik
f437c9ed9b Fix errors in zmq_getsockopt(3) manpage
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20 12:27:56 +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
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
ff93f54653 ZMQ_FILTER socket option added
This option is a performance tweak. In devices XSUB socket filters
the messages just to send them to XPUB socket which filters them
once more. Setting ZMQ_FILTER option to 0 allows to switch the
filtering in XSUB socket off.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-12 15:24:08 +02:00
Martin Sustrik
5d0cffc52f ZMQ_MULTICAST_HOPS socket option added
Sets the time-to-live field in every multicast packet sent from the socket.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-15 18:25:43 +02:00
Pieter Hintjens
a3b49ca958 Fixed example
Signed-off-by: Pieter Hintjens <ph@imatix.com>
2011-04-11 12:14:00 +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
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
bd9d7715eb ZMQ_RATE and ZMQ_RECOVERY_IVL types cahnged to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 15:18:20 +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
17e82a3611 ZMQ_SNDBUF and ZMQ_RCVBUF type changed to int
This mimics POSIX specification.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 14:48:50 +01:00
Martin Sustrik
a2252de2bc ZMQ_RECOVERY_IVL and ZMQ_RECOVERY_IVL_MSEC reconciled
There's only one option now -- ZMQ_RECOVRY_IVL --
and it's measured in milliseconds.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 14:36:40 +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
b45b68ae4a ZMQ_MCAST_LOOP removed
Multicast loopback is not a real multicast, rather a kernel-space
simulation. Moreover, it tends to be rather unreliable and lossy.
Removing the option will force users to use transports better
suited for the job, such as inproc or ipc.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-23 17:01:39 +01:00
Martin Sustrik
5fcef1cac4 ZMQ_MAXMSGSIZE option added
The new option allows user to guard against peers sending
oversized messages. Connection to peer sending oversized message
is dropped.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02 09:00:36 +01:00
Martin Sustrik
c22e52737a Minor patch to zmq_getsockopt(3) man page
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-24 16:57:53 +01:00
Thijs Terlouw
f7f1dfc86d ZMQ_RECONNECT_IVL_MAX socket option added
It allows for exponential back-off strategy when reconnecting.

Signed-off-by: Thijs Terlouw <thijsterlouw@gmail.com>
2011-01-26 07:01:06 +01:00
Bob Beaty
fcfad5682e Added Recovery Interval in Milliseconds
For very high-speed message systems, the memory used for recovery can get to
be very large. The corrent limitation on that reduction is the ZMQ_RECOVERY_IVL
of 1 sec. I added in an additional option ZMQ_RECOVERY_IVL_MSEC, which is the
Recovery Interval in milliseconds. If used, this will override the previous
one, and allow you to set a sub-second recovery interval. If not set, the
default behavior is to use ZMQ_RECOVERY_IVL.

Signed-off-by: Bob Beaty <rbeaty@peak6.com>
2010-12-09 21:42:58 +01:00
Martin Lucina
b70d628fad Documentation updates for 2.1
- Clarify ZMQ_LINGER, zmq_close (), zmq_term () relationship
- New socket options
- Clarify thread safety of sockets and migration between threads
- Other minor and spelling fixes

Signed-off-by: Martin Lucina <mato@kotelna.sk>
2010-12-01 10:57:37 +01:00
Jacob Rideout
0ada4f8e30 Fix documentation typos
Signed-off-by: Jacob Rideout <jacob.rideout@returnpath.net>
2010-11-04 21:21:01 +01:00
Martin Sustrik
0c86f90280 Minor typo fixed in zmq_getsockopt(3) man page.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-17 10:26:06 +02:00