summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
AgeCommit message (Collapse)Author
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-12Code dealing with messages moved to msg.cppMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-12zmq_utils implementation moved to zmq_utils.cppMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-12OpenPGM now doesn't redefine bool, we can drop the workaroundMartin 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-27zmq_recv() returns size of the message even if it's truncatedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-26Memory leak in zmq_recv fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24send/recv was changed to send/recv/sendmsg/recvmsgMartin Sustrik
send/recv now complies with POSIX by using raw buffers instead of message objects and by returning number of bytes sent/recvd instead of 0/-1. The return value is changed accordingly for sendmsg and recvmsg. Note that related man pages will be fixed in a separate patch. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-23zmq_device removedMartin Sustrik
Devices are basically applications on top of 0MQ stack. They should reside in separate libraties. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-23Timeout in zmq_poll is in millisecondsMartin Sustrik
The old timeout in microsecond haven't been compliant with POSIX and was impractical at the same time. 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-02-22Added explicit error message in case of memory exhaustionMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-18Fix MSVC and SunStudio builds with OpenPGMMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-13Build problem with OpenPGM and MSVC fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-12Fixed win32 issue with WSAStartupPieter Hintjens
- ctx constructor was calling mailbox_t constructor implicitly - moved WSAStartup and WSACleanup to be outside constructor/destructor Signed-off-by: Pieter Hintjens <ph@imatix.com>
2011-02-08zmq_poll with no fds behaves decentlyMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-20Remove unnecessary visibility pragmasMikko Koppanen
Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
2010-12-06All devices conflated into a single implementation.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-25Control symbol exports using -fvisibilityMartin Lucina
On systems using GCC 4.0 or newer which support symbol visibility in shared libraries, use -fvisibility=hidden and only export explict API functions defined in zmq.cpp. We do not enable -fvisibility on MinGW since this uses a separate mechanism (__declspec). Signed-off-by: Martin Lucina <mato@kotelna.sk>
2010-11-13Merge branch 'maint'Martin Sustrik
* maint: Couple of patches for AIX build
2010-11-13Couple of patches for AIX buildMartin Sustrik
- RAND_bytes function resides in crypto library - pollfd on AIX used 'reqevents' instead of events and 'retnevents' instead of 'revents' Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-12Fix a bug that zmq_poll's select backend spins when timeout=-1, due toChia-liang Kao
ptimeout not properly recalculated after first pass. Signed-off-by: Chia-liang Kao <clkao@clkao.org>
2010-10-30Name of "GNU Lesser Public License" corrected.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-23Changes for MSVC OpenPGM build.Steven McCoy
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
2010-10-16Couple of bugs in zmq_poll fixed.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-16Implementation of zmq_strerror moved from zmq.cpp to err.cppMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-14Safety measure in zmq_msg_close implementedMartin Sustrik
zmq_msg_close now empties the message on zmq_msg_close, thus not leaving random data in the structure, that may be mistaken for a valid message. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-13Precise timouts in zmq_poll implementedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-09Merge branch 'maint'Martin Sustrik
* maint: Version macros added Conflicts: builds/msvc/platform.hpp Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-09Version macros addedMartin Sustrik
Macro ZMQ_VERSION represents the current version of 0MQ Macro ZMQ_MAKE_VERSION(major,minor,patch) allows to create a representation of the specified version. The versions can be compared using simple <, >, ==, etc. operators. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-09-30zmq_poll(): Fix busy-loop if timeout is zeroMartin Lucina
Fix a case where zmq_poll() (poll-based version) could go off into a busy-loop if no revents are returned and the timeout passed in is zero.
2010-09-30 * Add assertions to check for OpenPGM calls with invalid parameters.Steven McCoy
* Assertion to check that pgm_getaddrinfo is actually returning something. * Missing pgm_connect call. * Typo on TOS causing immediate abort. * Placeholder calls for timeouts whilst continuing spin loop functionality. * OpenPGM v5 now supports reference counting so remove init checks. * Duplicate UDP unicast port setting, requires one unicast and one multicast. * Incorrectly set socket rcvbuf size with sndbuf. * Replace std::lexicographical_compare of TSI's with long word integer comparisons. * pgm_socket_t::receive returns -1 on no data.
2010-09-28Upgrade to OpenPGM-5.0.78Steven McCoy
2010-09-26clock_t class addedMartin Sustrik
2010-09-20zmq_poll (select version) now correctly assumes that ZMQ_FD is edge-trigerredMartin Sustrik
2010-09-20zmq_poll honours ZMQ_FORCE_POLL and ZMQ_FORCE_SELECT optionsMartin Lucina
2010-09-20minor problem in zmq_poll (select version) fixedMartin Lucina
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-04improved null checking in zmq_termIvo Danihelka
2010-09-04Merge branch 'maint'Martin Lucina
* maint: zmq::select_t, zmq_poll(): assert if FD_SETSIZE reached zmq.h: Fix typo and use of C99 comment Conflicts: src/zmq.cpp
2010-09-04zmq::select_t, zmq_poll(): assert if FD_SETSIZE reachedMartin Lucina
Ensure that 0MQ does not attempt to call select() on more than FD_SETSIZE file descriptors.
2010-08-28zmq_poll: account for the fact that ZMQ_FD is edge-triggeredMartin Sustrik
2010-08-27zmq_poll returns prematurely even if infinite timeout is set - fixedMartin Sustrik
2010-08-26improved null checking in zmq_termIvo Danihelka
2010-08-25dezombification procedure fixedMartin Sustrik
2010-08-25zmq_poll(): Fix some corner casesMartin Lucina
Trying to optimize out the case where items_[i]. events is 0 would result in a bogus pollfds[i]. Similarly in the select()-based impl, while not strictly necessary it's better to get ZMQ_FD even if events is 0 since that detects ETERM and friends.
2010-08-25zmq_poll(): Rewrite to use ZMQ_FD/ZMQ_EVENTS pt2Martin Lucina
Rewrite the select()-based zmq_poll() implementation to use ZMQ_FD and ZMQ_EVENTS. Also fix some corner cases: We should not pollute revents with unrequested events, and we don't need to poll on ZMQ_FD at all if a pollitem with no events set was passed in.
2010-08-25Fix whitespaceMartin Lucina
Dunno where those <TAB>s came from...
2010-08-25zmq_poll(): Rewrite to use ZMQ_FD/ZMQ_EVENTS pt1Martin Lucina
Rewrite zmq_poll() to use ZMQ_FD and ZMQ_EVENTS introduced on the wip-shutdown branch. Only do the poll()-based version of zmq_poll (), the select()-based version will not compile at the moment.