Commit Graph

200 Commits

Author SHA1 Message Date
Pieter Hintjens
076e081de2 Merge pull request #373 from ianbarber/master
Add ZMQ_DELAY_ATTACH_ON_CONNECT sockopt
2012-06-12 14:18:51 -07:00
Ian Barber
704b952274 Add reference to the inproc documentation
The previous note in connect introduced but did not elaborate on the
requirement to bind before connect in inproc. As that discussion is in
detail in the inproc docs link to there.
2012-06-12 15:49:18 +01:00
Ian Barber
7b78ed9d60 Update bind and connect documentation for clarity
Based on discussion with Steve O on the list, make the difference
between bind and connect usage more clear, and add a note reflecting the
fact that inproc must have bind before connect to reinforce the
information in zmq_inproc.
2012-06-12 15:46:26 +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
Steven McCoy
75df0194bf Fix title on zmq_disconnect manpage. 2012-05-30 12:53:53 -04:00
Pieter Hintjens
2ab12efe11 Fixing issue #361 2012-05-28 11:01:21 +02:00
Lourens Naudé
b85ff17822 Fix too long underline in monitor docs 2012-05-24 09:39:48 +01:00
Lourens Naudé
400f6f3863 Rename monitor documentation source file to match zmq_ctx_set_monitor() API 2012-05-23 01:35:22 +01:00
Lourens Naudé
adf7a7ade1 Merge branch 'master' into monitor-regressions 2012-05-22 23:35:30 +01:00
Lourens Naudé
991b7fcc04 Rename zmq_monitor to zmq_ctx_set_monitor for compat with existing context specific APIs 2012-05-22 20:15:18 +01:00
Lourens Naudé
04f0e7f26e Documentation for zmq_monitor 2012-05-22 20:08:02 +01:00
Pieter Hintjens
604456a8b0 Man page for zmq_ctx_new had error, fixed 2012-05-21 15:59:55 -05:00
Ricardo Catalinas Jiménez
0e053e3478 Doc improvement: document interface omission in zmq_pgm.txt
The PGM transport supports the omission of the network interface to
select the default one like:

  announce.connect("epgm://eth0;239.255.128.46:64646"); // Use eth0
  announce.connect("epgm://239.255.128.46:64646"); // Use the default

Also, mention C++ in the additional community bindings of 0MQ in
zmq.txt.
2012-05-21 14:06:34 +02: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
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é
d0461752ff Merge branch 'master' into events 2012-05-11 22:08:17 +01:00
Ian Barber
e65d228f4f gitignore endpoint test and add docs for unbind and disconnect 2012-05-11 14:17:45 +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
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
Ian Barber
206d80b5ff Make docs reflect socket mappings better 2012-04-16 14:08:15 +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
Pieter Hintjens
f26e4ab784 Simplified zmq_msg_get/set functions
* Return integer property
* Fixed up man pages, which were inaccurate
* Fixed test case
2012-03-21 14:19:40 -05:00
Pieter Hintjens
1e4c5b293a Merge branch 'issue-337' 2012-03-20 10:18:15 -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
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
Pieter Hintjens
9ac40c47d7 Fixed issue LIBZMQ-333
- reverted commit 941be8d217.
 - fixed zmq_device implementation for latest socket_base class
 - added back zmq_device.3 man page
2012-03-16 16:39:11 -05:00
Kobolog
8095a129e8 man entry for the new option 2012-03-15 15:06:44 +03:00
staticfloat
020f777e09 Eliminate unnecessary line break 2012-03-12 15:18:32 -07: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
9e622d542a Merge pull request #256 from ianbarber/master
Removing old ECANTROUTE documentation
2012-02-17 07:03:39 -08:00
Mikko Koppanen
da1920d944 Revert NULL checks in the API 2012-02-17 09:48:04 +00:00
Ian Barber
82bd5431ce Updating documentation to remove ECANTROUTE error code 2012-02-17 08:01:36 +00:00
Pieter Hintjens
0efb49f12f Fixed up all references to zmq_msg_size 2012-02-16 12:26:00 -06:00
Mikko Koppanen
2f44faa7ce Merge pull request #247 from pieterh/sendrecv
Added zmq_msg_send/recv functions
2012-02-16 08:58:03 -08:00
Pieter Hintjens
d092f2615c Renamed peek/poke to get/set 2012-02-15 19:28:29 -06:00
Pieter Hintjens
dcc1725a90 Renamed zmq_getmsgopt to zmq_msg_peek
* Added zmq_msg_poke for orthogonality
* Added zmq_msg_more for simplicity
* Fixed up man pages and test program
2012-02-15 18:44:28 -06:00
Pieter Hintjens
fb4748f257 Added zmq_msg_send/recv functions 2012-02-15 15:37:35 -06:00
Pieter Hintjens
5f6b95f4a2 Fixed footers to refer to man page, not all docs 2012-02-15 10:39:18 -06:00
Pieter Hintjens
c85ecfc066 Cleaned up description of multi-part messages 2012-02-15 10:39:18 -06:00
Pieter Hintjens
636de46fe1 Removed section on devices, added new methods 2012-02-15 10:39:18 -06:00
Pieter Hintjens
086c059430 Ported numerous fixes from 2.1 man page 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