Commit Graph

211 Commits

Author SHA1 Message Date
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
Lourens Naudé
06cce15479 Change zmq_monitor_fn type to cast between pointer-to-object and pointer-to-function in a more standards compliant way 2012-05-20 18:22:13 +01: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
Sergey KHripchenko
acba6bdd6c Implement ZMQ_TCP_ACCEPT_FILTER setsockopt() for listening TCP sockets.
Assign arbitrary number of filters that will be applied for each new TCP transport
connection on a listening socket.
If no filters applied, then TCP transport allows connections from any ip.
If at least one filter is applied then new connection source ip should be matched.
To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0).
Filter is a null-terminated string with ipv6 or ipv4 CIDR.

For example:
localhost
127.0.0.1
mail.ru/24
::1
::1/128
3ffe:1::
3ffe:1::/56

Returns -1 if the filter couldn't be assigned(format error or ipv6 filter with ZMQ_IPV4ONLY set)

P.S.
The only thing that worries me is that I had to re-enable 'default assign by reference constructor/operator'
for 'tcp_address_t' (and for my inherited class tcp_address_mask_t) to store it in std::vector in 'options_t'...
2012-04-12 18:37:14 +04: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
Pieter Hintjens
ba798ee8f3 Fixed issue #325 2012-03-23 17:32:26 -05: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
Kobolog
8095a129e8 man entry for the new option 2012-03-15 15:06:44 +03:00
Pieter Hintjens
5f6b95f4a2 Fixed footers to refer to man page, not all docs 2012-02-15 10:39:18 -06: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
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
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
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
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
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
fac9c2da56 zmq_socket(3) and zmq_setsockopt(3) man pages improved
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-16 16:32:31 +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
Michael Compton
fbe5d859f4 Added note regarding setting sockopt before bind/connect
Signed-off-by: Michael Compton <michael.compton@littleedge.co.uk>
2011-02-15 09:33:19 +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
a780833683 ZMQ_BACKLOG socket option added.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-17 10:23:58 +02:00
Martin Sustrik
e8e2944f45 ZMQ_RECONNECT_IVL socket options added.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-17 09:54:12 +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
91ea204644 EINTR returned from the blocking functions 2010-09-08 08:39:27 +02:00
Martin Lucina
32baeb610e Revert "Various changes to documentation project:"
This reverts commit 77a3c36ff1.
2010-09-04 15:55:11 +02:00
Martin Lucina
6c393f53e2 Revert "Further cleanups on reference manual"
This reverts commit 13f3481e12.

Conflicts:

	doc/zmq_device.txt
	doc/zmq_tcp.txt
2010-09-04 15:54:34 +02:00
Pieter Hintjens
e74d350068 Fixed (un)signed type errors in get/setsockopt manual 2010-08-11 17:00:12 +02:00
Pieter Hintjens
b6cdd369e3 Added error checking (EFAULT) for null arguments
* Fixed zmq_term, zmq_socket, zmq_close, zmq_setsockopt,
* zmq_getsockopt, zmq_bind, zmq_connect, zmq_send,
* zmq_recv, zmq_poll, zmq_device, zmq_stopwatch_stop
* Updated Reference Manual for these methods
2010-08-08 11:43:32 +02:00
Pieter Hintjens
13f3481e12 Further cleanups on reference manual
- fixed unwrapped text in new man pages
- fixed over-long lines in older pages, where possible
- removed reference to old standalong devices from index page
- added refernce to new zmq_device[3] documented from index page
- some minor spelling corrections
2010-08-04 16:05:25 +02:00
Pieter Hintjens
77a3c36ff1 Various changes to documentation project:
* Added documentation for zmq_deviced, which we're developing
* Created consistent page footer in documentation template
* Page footer notes doc authors and copyright statement
2010-08-04 14:43:33 +02:00
Martin Lucina
10f4bf3f35 Documentation: Cosmetic changes 2010-06-03 14:15:05 +02:00
Martin Lucina
7c9b09bc51 Documentation: Flow control, zmq_socket(3)
Mostly Flow control and additions to zmq_socket(3)
Removed/changed lots of text regarding message queues
More fixes for 2.0.7 changes
2010-06-02 18:36:34 +02:00
Martin Lucina
8ba1d3c8ed Documentation: zmq_term() and ETERM for 2.0.7 2010-06-01 22:22:29 +02:00
Martin Lucina
8becacf82c Documentation updates
Add zmq_getsockopt(3), clean up zmq_setsockopt(3).
2010-05-31 12:53:40 +02:00
Martin Lucina
5219e4ce8f Clarify socket types in documentation, reinstate ZMQ_PAIR 2010-05-28 00:49:13 +02:00
Martin Sustrik
8408ae066d LWM is computed rather than explicitly specified by user 2010-05-25 15:03:57 +02:00
Martin Sustrik
d524c4e15d fix of documentation typo 2010-04-16 09:53:09 +02:00
Martin Sustrik
3236cb1a54 ETERM is accounted for in the documentation 2010-04-12 09:25:04 +02:00
Martin Lucina
a7973a2c49 Documentation fixes 2010-04-06 15:23:13 +02:00
Martin Lucina
98801ebcae Documentation fixes 2010-03-10 12:19:39 +01:00
Martin Lucina
1aee86408d Documentation rewrite 2010-03-09 18:47:31 +01:00
Martin Sustrik
75f571c884 Multi-hop REQ/REP, part XII., generate unique identities for anonymous connections 2010-02-19 15:24:43 +01:00
Martin Lucina
354efc513f Convert documentation to AsciiDoc 2010-02-10 16:18:46 +01:00