summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
AgeCommit message (Collapse)Author
2011-06-23Outstanding requests dropped when requester dies (issue 190)Martin Sustrik
So far the requests in req/rep pattern were delivered to and processed by worker even though the original requester was dead. Thus, the worker processing replies with noone to deliver results to. This optimisation drops requests in two situations: 1. Queued inbound requests in XREP socket when peer disconnects. 2. Queued outbound requests in XREQ when socket is closed. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-22New wire format for REQ/REP patternMartin Sustrik
This patch introduces two changes: 1. 32-bit ID is used to identify the peer instead of UUID 2. REQ socket seeds the label stack with unique 32-bit request ID It also drops any replies with non-matching request ID Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20Introduce ZMQ_ROUTER and ZMQ_DEALER socketsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20LABEL flag added to the wire formatMartin Sustrik
So far there was no distinction between message parts used by 0MQ and message parts used by user. Now, the message parts used by 0MQ are marked as 'LABEL'. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20Fix minor warning in MSVC buildMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-17Add sockopt ZMQ_RCVTIMEO/ZMQ_SNDTIMEO.Fabien Ninoles
- 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-05-31Session termination induced by socket fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-30Patches from sub-forward branch incorporatedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-25All pipe termination code moved to pipe_tMartin Sustrik
Till now the code was spread over mutliple locations. Additionally, the code was made more formally correct, with explicit pipe state machine etc. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-23Move the pipe termination code to socket_base_tMartin Sustrik
So far, the pipe termination code was spread among socket type classes, fair queuer, load balancer, etc. This patch moves all the associated logic to a single place. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-22Introduces bi-directional pipesMartin Sustrik
So far, there was a pair of unidirectional pipes between a socket and a session (or an inproc peer). This resulted in complex problems with half-closed states and tracking which inpipe corresponds to which outpipe. This patch doesn't add any functionality in itself, but is essential for further work on features like subscription forwarding. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-29Substantial simplification of uuid_tMartin Sustrik
The string format of UUID is not used in 0MQ. Further on, it turns out that UUIDs have fixed microarchitecture-agnostic binary layout (see RFC4122). Thus, the conversion to string and back to binary can be avoided. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-21Message-related functionality factored out into msg_t class.Martin Sustrik
This patch addresses serveral issues: 1. It gathers message related functionality scattered over whole codebase into a single class. 2. It makes zmq_msg_t an opaque datatype. Internals of the class don't pollute zmq.h header file. 3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33% of memory in scenarios with large amount of small messages. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-19Message validity is checked in the runtimeMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-09Run-time checking for context & socket validity addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-26ZMQ_NOBLOCK renamed ZMQ_DONTWAITMartin Sustrik
Done because of POSIX compliance Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24ZMQ_HWM split into ZMQ_SNDHWM and ZMQ_RCVHWMMartin Sustrik
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-24ZMQ_HWM type changed to intMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24ZMQ_EVENTS type changed to intMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24ZMQ_RCVMORE type changed to intMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24SWAP functionality removedMartin Sustrik
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-16Duplicate identities now checked with zmq_connectMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02The copyrights in file headers updated.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-01Explicit identities bug in inproc transport fixed.Martin Sustrik
The identity of bound socket was not used. Instead, transient identity was generated. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-25Socket with no owner objects is deallocated immediatelyMartin Sustrik
Till now the deallocation of such socket was delayed till zmq_term() thus creating a "leak". Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-22Added explicit error message in case of memory exhaustionMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-09Reaper thread waits for commands rather them retrieving them periodicallyMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-09Initial implementation of reaper thread.Martin Sustrik
Reaper thread destroys the socket asynchronously. zmq_term() can be interrupted by a signal (EINTR). zmq_socket() will return ETERM after zmq_term() was called. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-28Fixed the problem of subscription forwarding and PGM interactionMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-10Size of inproc hwm and swap is sum of peers' hwms and swapsMartin Sustrik
The meat of the patch was contributed by Douglas Creager. Martin Sustrik implemented storing peer options in inproc endpoint repository. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-05Return ETERM from getsockopt(ZMQ_EVETS) if zmq_term() was calledMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-12-13add basic uri validationsDhammika Pathirana
Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
2010-12-04XPUB and XSUB socket types added.Martin Sustrik
These are just placeholders. At the moment XPUB behaves th same as PUB and XSUB as SUB. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-12Merge branch 'maint'Martin Sustrik
* maint: Fix socket_t::recv() hang scenario where initial call to process_commands() eats signal Conflicts: src/socket_base.cpp
2010-11-12Fix socket_t::recv() hang scenario where initial call to process_commands() ↵Marc Rossi
eats signal Added block boolean var to second process_commands() invocation for blocking sockets instead of always using true. This prevents the process_commands() call from hanging when a message is received with an empty queue after the call to xrecv() but prior to the initial call to process_commands() invoked when ++ticks == inbound_poll_rate. Signed-off-by: Marc Rossi <mrossi19@gmail.com>
2010-11-05signaler renamed to mailboxMartin Sustrik
For historical reasons queue to transfer commands between threads was called 'signaler'. Given that it was used to pass commands rather than signals it was renamed to 'mailbox', see Erlang mailboxes. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-05slots renamed to tidsMartin Sustrik
Threads were so far identified by integers called 'slots'. This patch renames them to more comprehensible 'tid's (thread IDs). Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30Name of "GNU Lesser Public License" corrected.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-16ZMQ_LINGER socket option added.Martin Sustrik
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-14To insert to associateive STL containers value_type used instead of make_pairMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-09-26clock_t class addedMartin Sustrik
2010-09-26Merge branch 'maint'Martin Sustrik
* maint: if TSC jumps backwards (in case of migration to a different CPU core) latency peak may occur -- fixed Conflicts: src/app_thread.cpp
2010-09-21The flag in the socket has clear semantics now -- it tracks whether ↵Martin Sustrik
corresponding context was closed, it doesn't track whether zmq_close was called on the socket itself
2010-09-18potential duplicate termination of pipes removedMartin Sustrik
2010-09-09when no I/O threads are available error is raised instead of assertionMartin Sustrik
2010-09-08EINTR returned from the blocking functionsMartin Sustrik
2010-09-01sys transport introdced; inproc://log moved to sys://logMartin Sustrik
2010-08-30Issue 54 - socket_base.cpp:162 comparison errorMartin Sustrik
2010-08-28terminology unified: revive->activateMartin Sustrik
2010-08-28bug in pipe deactivation fixedMartin Sustrik