Commit Graph

80 Commits

Author SHA1 Message Date
Kobolog
08749c8e7b Removed an unneeded include in tests 2012-06-17 02:38:15 +04:00
Kobolog
6da48aed3a Fixed tests 2012-06-17 02:36:08 +04:00
Kobolog
829d0003be Verbose ROUTER socket behavior patch 2012-06-17 02:33:43 +04:00
Ian Barber
c7c834a945 Add unistd header to test_connect_delay header
For sleep and usleep
2012-06-13 12:18:22 +01:00
Ian Barber
35c55a2cde Add newline to end of test_connect_delay file 2012-06-13 07:47:18 +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
409d5e8fff 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:31:23 +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
81b8362a59 Revert "Fix a number of whitespace issues in various parts of the code, add validation to most calls on the test and take a first stab at implementing the reconnection pipe blocking."
This reverts commit 6f6466f088.
2012-06-12 14:51:50 +01:00
Ian Barber
6c382c5c61 Revert "Fix whitespace in test"
This reverts commit 0b3478d6ec.
2012-06-12 14:51:19 +01:00
Ian Barber
4aaf3e6389 Revert "Add disconnect test"
This reverts commit d8f3487ee1.
2012-06-12 14:44:12 +01:00
Ian Barber
eb14890d23 Revert "Revert "Merge branch 'master' of github.com:ianbarber/libzmq""
This reverts commit 029d3dfae2.
2012-06-12 14:43:18 +01:00
Ian Barber
029d3dfae2 Revert "Merge branch 'master' of github.com:ianbarber/libzmq"
This reverts commit 3345902979, reversing
changes made to 889b0e6f29.
2012-06-12 14:13:17 +01:00
Ian Barber
6117a2b099 Revert "Replace incomplete count with a std::set"
This reverts commit 4aa5ba3d11.
Unintentional merge
2012-06-12 14:07:54 +01:00
Ian Barber
4aa5ba3d11 Replace incomplete count with a std::set
This commit removes the countdown flag and adds a set to store the pipes
that are currently being disconnected.
2012-06-12 12:13:21 +01:00
Ian Barber
d8f3487ee1 Add disconnect test
Add a new section to the connect delay test that disconnects and
reconnects a socket to ensure that some messages are appropriately
blocked.
2012-06-11 20:04:09 +01:00
Ian Barber
0bf1d0262e Merge branch 'master' of https://github.com/zeromq/libzmq 2012-06-08 23:55:58 +01:00
Hiten P
31cb1f297d Change connection failure test to use an invalid hostname
- invalid hostname set to 0mq.is.the.best (naturally!)
- issue happens as other valid-like non-existent hostnames were
  redirected by buggy Cable/ISP DNS servers
2012-06-08 13:15:45 +01:00
Ian Barber
09d18e4b3c Merge branch 'master' of https://github.com/zeromq/libzmq 2012-06-05 18:32:15 +01:00
AJ Lewis
3687789f9d Fix build on RHEL5 and SLES10
GCC 4.1.2 on RHEL5 and SLES10 don't like not having a newline at the
end of a source file, and error out if it's missing.

Signed-off-by: AJ Lewis <aj.lewis@quantum.com>
2012-06-05 09:22:22 -05:00
Ian Barber
0b3478d6ec Fix whitespace in test 2012-06-03 23:11:08 +01:00
Ian Barber
6f6466f088 Fix a number of whitespace issues in various parts of the code, add validation to most calls on the test and take a first stab at implementing the reconnection pipe blocking.
It didn't seem straightforward to use any of the existing process calls, so I have added a new command to command_t and friends called detach. This instructs the socket_base to remove the pipe from it's pipe list. The session base stores a copy of the outpipe, and will resend the bind command on reconnection. This should allow balancing again.
2012-06-03 22:57:47 +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é
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é
4767159f39 Initial stab at a context level monitor callback and registration API 2012-05-21 20:47:11 +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
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
Martin Hurton
873abdd24c Rename XREP/XREQ to ROUTER/DEALER in tests 2012-04-25 01:05:38 +02:00
Sergey KHripchenko
4f668ad60a added zmq_unbind() / zmq_disconnect() test script.
it works but rises very serious questions.

Please add license header by your choice.
This file for 99% resemble crossroads-io/tests/shutdown.cpp
2012-04-21 18:39:19 +04: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
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
Mikko Koppanen
5d7450d65e Improve the test for last_endpoint, use the same ports as other tests 2012-02-19 23:19:17 -06: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
Mikko Koppanen
d00d4843be More fixes for ZMQ_LAST_ENDPOINT. Added a test 2012-02-18 20:44:41 +00:00
skaller
916f1a524d Remove build script references to test_ts_context. 2012-02-18 02:41:17 +11:00
skaller
e7da123b28 Remove thread safe test. 2012-02-18 02:34:59 +11:00
Pieter Hintjens
bfbe556e00 Merge pull request #250 from gimaker/connect-assert
Resolve addresses in the calling thread on connect.
2012-02-16 10:35:48 -08:00
Staffan Gimåker
b9fb48f47b Resolve addresses in the calling thread on connect.
This allows us to actually report an error to the caller on resolve
failure, rather than asserting later on in the io thread.

Signed-off-by: Staffan Gimåker <staffan@spotify.com>
2012-02-16 14:42:55 +01: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
skaller
81662d70be Add a test for thread safe sockets. 2012-02-04 15:13:36 +11:00
Philip Kovacs
bf9062902c Fix broken VPATH/parallel builds
Signed-off-by: Philip Kovacs <phil@philkovacs.com>
2011-11-21 08:10:03 +01:00
Chuck Remes
93529d8c5d Add zmq_getmsgopt to the API
The new function allows to retrieve options (flags)
from zmq_msg_t.

Signed-off-by: Chuck Remes <cremes@mac.com>
Renamed from zmq_msg_flags to zmq_getmsgopt
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-06 14:03:51 +01:00
Martin Sustrik
6503716203 Minor typo corrected
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-05 11:38:50 +01:00
Martin Sustrik
a4843b65d2 Identities re-introduced
However, the "durable socket" behaviour wasn't re-added.
Identities are used solely for routing in REQ/REP pattern.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-04 08:00:47 +01:00
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
7563518929 Tests print their name before running
This makes finding out which test have hung-up easier.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 13:54:28 +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