Age | Commit message (Collapse) | Author |
|
This patch fixes a bug in the message encoder which was
responsible for computing incorrect message offset.
The bug affected PGM receiver making it unable to
decode inital messages.
|
|
On Windows and OpenVMS there is no IPC transport. This patch fixes the
problem introduced by previous patches, where the fact is not taken
into account.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
|
|
This prevents the long-standing issue of an invalid pgm or epgm connection
string from causing an assert when the connection is attempted and fails.
|
|
This patch reintroduces the behaviour that if a tcp:// or ipc:// connection
string which is invalid is passed to xs_connect, then an error is reported,
instead of asserting at connection time
|
|
EAGAIN was being used as a translation value for EINPROGRESS, thus
shadowing a real EAGAIN return value from the OS. This caused later
assertions of "Invalid argument" in stream_engine.cpp when it attempted to
use a socket which was not connected.
I also add EINTR to mean EINPROGRESS, as per the POSIX and FreeBSD
documentation which specifies that a connect() call interrupted due to a
signal will complete asynchronously.
Signed-off-by: Martin Lucina <martin@lucina.net>
|
|
Feature checks are introduced to check for all the headers required by
the select() and poll() calls. Include files are then included
conditionally without the use of any OS-specific directive. The change
also fixes a couple of problems:
- Fixed compilation under FreeBSD, NetBSD and OpenBSD when forcing the
use of select() in the poller
- Quieted a warning mixed-sign comparison warning on FreeBSD caused by
FD_SETSIZE being declared as an unsigned constant on that OS
- Removed the obsolescent AC_HEADER_TIME macro from the configure script
Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
|
|
This reverts commit 512f3a604924fec9d89e2b4bfd6f73aa66309fa7.
|
|
The commands was a vestige of the removed 'durable sockets' feature
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Paul Colomiets <paul@colomiets.name>
|
|
Implements SP protocol versioning, legacy protocol support, and the
following pattern protocol versions:
PAIR: v2
PUBSUB: v1 (legacy), v3
REQREP: v1
PIPELINE: v2
SURVEY: v1
Engine support is only for stream_engine_t at this stage.
Signed-off-by: Martin Lucina <martin@lucina.net>
|
|
When socket in the process of asynchronous connect is being closed
and the fact that there is no peer is found out at the same time
close() may return ECONNRESET. This patch handles this situation
decently.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
As per Patrick Trantham comment
http://groups.crossroads.io/r/topic/510xaadGgWVcXFdATnhAuN
the GCC __sync_*() builtins are more generic but slower than specialized
hand-written assembly for armv7a case.
Therefore, the code is reordered for prefer inline assembly for armv7a
over GCC builtins.
* src/atomic_counter.hpp:
(atomic_counter_t::add):
(atomic_counter_t::sub):
* src/atomic_ptr.hpp:
(atomic_ptr_t::xchg):
(atomic_ptr_t::cas):
Prefer armv7a specific inline asm over GCC __sync_*() builtins.
|
|
* configure.ac:
Check for working Solaris/NetBSD-style atomic.h independly on OS.
Add check for GCC-style __sync_*() builtins.
New defines: XS_ATOMIC_GCC_SYNC, XS_ATOMIC_SOLARIS.
Removed define: XS_FORCE_MUTEXES.
* src/atomic_counter.hpp:
(atomic_counter_t::add):
(atomic_counter_t::sub):
* src/atomic_ptr.hpp:
(atomic_ptr_t::xchg):
(atomic_ptr_t::cas):
Use result of these checks.
Preference order:
1. GCC-style __sync_*() builtins
2. Inline asm (x86, x86-64, armv7a)
3. Solaris/NetBSD-style atomic.h, Windows-specific API
4. Fallback to mutex-based implementation
|
|
Use GCC __sync_*() builtins when compiler claims to be GCC (GCC itself,
Clang...)
It can be disabled explicitly by using XS_DISABLE_GCC_SYNC_BUILTINS
define. Just for any case.
* src/atomic_counter.hpp [__GNUC__ && !XS_DISABLE_GCC_SYNC_BUILTINS]:
(atomic_counter_t::add):
(atomic_counter_t::sub):
* src/atomic_ptr.hpp [__GNUC__ && !XS_DISABLE_GCC_SYNC_BUILTINS]:
(atomic_ptr_t::xchg):
(atomic_ptr_t::cas):
Prefer GCC __sync_*() builtins over inline asm.
|
|
This commit implements atomic operations for the armv7a architecture
using gcc inline assembly. This offers higher performance compared to
pthread mutexes.
Tested on an am3517 evm, clocked at 600MHz:
./inproc_thr 200 1000000
------------------------
53-60K messages / sec, pthread mutexes
73-90K messages / sec, assembly atomic ops
./inproc_lat 200 1000000
------------------------
average latency: 42.234 [us], pthread mutexes
average latency: 35.496 [us], assembly atomic ops
|
|
|
|
This patch is based on patch by Martin Hurton from 0MQ project.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch is a preliminary work for mergine TCP and IPC connecters
and listeners. The ultimated goal is to avoid code duplication
occuring in these classes.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Optimisation. Up to now new fd_set was initialised in
each signaler_wait call. Now the fd_set is initialised
once when signaler is created. This is useful espacially on
Windows where fd_set is list of pointers rather than bitset
and thus can be rather large.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch provides a single place for selecting polling mechanisms
(polling.hpp). Up to now the selection was spread among the build
system and several source files.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch allows for partial shutdown of the socket.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
SURVEYOR socket now uses clock instance from socket_base_t
for measuring survey timeout. This allows for better performance
in tight xs_recv() loops.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This fixes a critical bug in zmq_getsockopt.
|
|
This patch instantiate a clock_t instance for each XS
socket. Thus, it is shared between subsequent calls
to xs_recv (and xs_send). That in turn significantly
limits the number of invocations of getimeofday (or similar)
when timeouts are used and recv/send is called in a
tight loop.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This is an optimisation. The idea is that when surveyor disappears
it makes no sense to process any surveys it have sent. There are
two cases handled:
- when (X)SURVEYOR socket is closed any unsent outbound messages
are discarded
- when (X)RESPONDENT detects that its peer have disconnected it
drops any unprocessed messages that have been received from it
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
It can be used to timeout the survey. Value is in milliseconds
and -1 means infinite (default).
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Survey pattern is "multicast with reply". There are two roles:
surveyor and respondent. Surveyor publishes a survey which gets
delivered to all connected respondents. Each repondent can send
a response to the survey. All the responses are delivered to
the original surveyor. Once the surveyor decides that the survey
is over (e.g. deadline was reached) it can send initiate survey.
Late responses from old surveys are automatically discarded by
the surveyor socket.
Socket types: SURVEYOR, XSURVEYOR, RESPONDENT, XRESPONDENT
Patch also includes a test program with surveoyr, two respondents
and an intermediary device.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
- couple of comments adjusted
- empty 'stack delimiter' message correctly closed
- non-reachable function xrep_t::rollback() removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
While --with-poller configure option could be used for selecting
the polling mechanism for I/O threads (asynchronous), synchronous
polling (xs_poll, signaler_t) was not affected by the option.
This patch uses selected mechanism is it is either 'select' or 'poll'.
Othrwise it chooses the mechanism according to the platform.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
thread_t is one of the classes where C++ syntax creates more
problems then it solves. This patch converts it into simple
C-style pseudo-class.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Till now the subscription, as specified by the user, was send
upstream.
This patch allows SUB-side filter to transform the user subscription
into wire subscription. For example, only a has can be sent upstream
instead of a perfect subscription.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch propoagates the error from signaler and mailbox
initialisation up the stack.
To achieve this signaler and mailbox classes were re-written
is C-like syntax.
Finally, shutdown_stress test now ignores EMFILE/ENFILE errors.
Thus, the tests should pass even on OSX which sets the max
number of file descriptors pretty low by default.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
- subscription forwarding is handled by XSUB socket
- filtering is handled by SUB sockets
- subscriptions are decoupled from filter engines
- filter doesn't have to be able to enumarate the subscriptions
(no sf_enumerate function)
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
* src/stream_engine.cpp (stream_engine_t::stream_engine_t):
Use
#ifdef SO_NOSIGPIPE
instead of
#if defined XS_HAVE_OSX || defined XS_HAVE_FREEBSD
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch consolidates the up-to-now scattered code that
sets different options on newly created sockets.
There are open_socket and open_tcp_socket functions that
do the tuning automatically.
In case the socket is not created but got from elsewhere
(such as accept() call) there are tune_socket and tune_tcp_socket
functions that will do the tuning.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
On Windows, HANDLE_FLAG_INHERIT is equivalent to
O_CLOEXEC on UNIX.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
on laggy networks
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
|