summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
AgeCommit message (Collapse)Author
2012-05-25Implement SP wire protocolMartin Lucina
Implements the SP wire protocol, and infrastructure for legacy wire protocol support. Also added an XS_SERVICE_ID socket option to set the service id and renamed the XS_PROTOCOL option to XS_PATTERN_VERSION. The following pattern versions are supported: PAIR: v3 PUBSUB: v1 (legacy), v4 REQREP: v2 PIPELINE: v3 SURVEY: v2 Note that all existing pattern versions have been bumped by 1 to allow for use of legacy protocols (otherwise there would be no way to distinguish between e.g. PUBSUB v3 and PUBSUB v3 using SP). Signed-off-by: Martin Lucina <martin@lucina.net>
2012-05-11Command throttling breaking HWM algorithms -- fixed.Martin Sustrik
When HWM was set to small value it may have happened that command indicating that pipe is ready for writing wasn't processed because of command throttling. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-05-11Improve command processing efficiencyMartin Sustrik
When processing commands with throttling switched off, RDTSC instruction was executed, but the result was never used. This patch eliminates the unneeded instruction. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-05-09Build on Windows and OpenVMS fixedMartin Sustrik
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>
2012-05-09Return an error on invalid (e)pgm:// connectionDouglas Young
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.
2012-05-06Return error if an invalid connection string is usedDouglas Young
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
2012-05-01Revert "Implement protocol versioning (except PGM)"Martin Sustrik
This reverts commit 512f3a604924fec9d89e2b4bfd6f73aa66309fa7.
2012-04-29Implement protocol versioning (except PGM)Martin Lucina
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>
2012-04-21xs_shutdown implementedMartin Sustrik
This patch allows for partial shutdown of the socket. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-20Clock instance removed from surveyor_tMartin Sustrik
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>
2012-04-18Improve efficiency of time measurement in tight loopsMartin Sustrik
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>
2012-04-17XS_SURVEY_TIMEOUT socket option added.Martin Sustrik
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>
2012-04-17"Survey" pattern implementedMartin Sustrik
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>
2012-04-15Report EMFILE/ENFILE from xs_socket()Martin Sustrik
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>
2012-04-07Fix identity exchange for inproc transportMartin Hurton
The socket connecting using the inproc transport never received the identity of the remote peer.
2012-04-06Flush identity message for inproc transportMartin Hurton
The scoket implementation for inproc transfer failed to flush identity message. The result was that the identity message was not delivered until after the user sent the first message. The identity message was never delivered if the user used the socket only to receive messages.
2012-04-06EMTHREAD error code removedMartin Sustrik
libxs (as opposed to libzmq) requires at least one I/O thread per context. Thus, "no I/O thread available" error doesn't make sense anyome. This patch removes the code and the documentation. It keeps the definition of EMTHREAD itself for backward compatibility. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-06Verious warnings generated by SunStudio fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-040MQ/2.1 wire format compatibility implementedMartin Sustrik
- XS_PROTOCOL option added - libxs ignores when unused flags are set to 1 (0MQ/2.1 bug) - compatibility tests added Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Full name of the project used in license headersMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16ZMQ_REENTRANT functionality removedMartin Sustrik
It doesn't play well with multipart messages. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16poller_base_t renamed to io_thread_tMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16io_thread_t merged with poller_base_tMartin Sustrik
The relationship of these two classes was 1:1. Thus one of them was obsolete. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Socket re-entrancy rewrittenMartin Sustrik
The inspiration for this re-write came form John Skaller's patch. Adding him to Credits section of the AUTHORS file. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Race condition during socket close fixedMartin Sustrik
zmq_close() cannot be synchronised even though ZMQ_REENTRANT is set. It's user's responsibility not to invoke the socket from another thread once zmq_close() have been called. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16XS_CTX_REENTRANT option addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Fix data loss for PUB/SUB and unidirectional transports (LIBZMQ-268)Martin Lucina
With the introduction of subscription forwarding, the first message sent on a PUB socket using a unidirectional transport (e.g. PGM) is always lost due to the "subscribe to all" being done asynchronously. This patch fixes the problem and also refactors the code to have a single point where the "subscribe to all" is performed. Signed-off-by: Martin Lucina <martin@lucina.net>
2012-02-16Timers identified by dynamically generated handlesMartin Sustrik
Timers are not longer identified by hard-wired IDs. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16poller_base_t is used instead of poller_tMartin Sustrik
Poller object is virtualised. You can access poller via its base class (poller_base_t) instead of using poller_t which was a typedef pointing to actual derived class. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Improve checking for the invalid socketsMartin Sustrik
Till now the "valid" tag of the socket was removed only after the socket was properly deallocated by the reaper thread. That allowed user to access it while it was in the process of being deallocated. Now, the "valid" tag is removed as soon as zmq_close is called. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16File descriptor passed to in_event and out_eventMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16TODO addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16ZeroMQ renamed to CrossroadsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Remaining part of the logging infrastructure removedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Socket ID addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-12-16zmq_sendmsg and zmq_recvmsg checks for NULL message objectMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-06Add zmq_getmsgopt to the APIChuck Remes
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-05Use identities in inproc transportMartin Sustrik
Previous patches have missed the case when the identity should be sent from an inproc endpoint. Fixed. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-04Identities re-introducedMartin Sustrik
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-01Copyright dates adjusted to reflect realityMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01LABELS and COMMANDs removedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31VTCP transport removedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31250bpm copyrights addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31New style ROUTER socket removed.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@turist.(none)>
2011-09-15Session class separated into socket-type-specific sessionsMartin Sustrik
This is a preliminary patch allowing for socket-type-specific functionality in the I/O thread. For example, message format can be checked asynchronously and misbehaved connections dropped straight away. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-01Fixed warnings on Win64Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Dead code removed from TCP and IPC transportsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Implementations of TCP and IPC transports separatedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-26Experimental VTCP listener addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-26TCP transport classes simplifiedMartin Sustrik
zmq_engine and tcp_socket merged into tcp_engine zmq_connecter and tcp_connecter merged into tcp_connecter zmq_listener and tcp_listener merged into tcp_listener Signed-off-by: Martin Sustrik <sustrik@250bpm.com>