0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-21 15:12:03 +08:00

1878 Commits

Author SHA1 Message Date
Markus Pfeiffer
ee984b1fe6 Make DragonFly a first class citizen in terms of compilation 2015-09-03 09:00:12 +01:00
Constantin Rack
bb9788867f Problem: return code of make_fdpair() is not checked. Fixes #1558 2015-09-02 23:19:27 +02:00
Constantin Rack
0e1448a26f Merge pull request #1550 from xaqq/master
Problem: Identity frame from router has no metadata
2015-08-24 22:35:31 +02:00
Joe Eli McIlvain
33419425eb Problem: Private/internal macros defined in public header.
Solution: Move the macros to a private header.
2015-08-21 16:12:22 -07:00
reza.ebrahimi
63260d8701 rename ZMQ_UNUSED macro to LIBZMQ_UNUSED 2015-08-22 00:31:25 +04:30
Richard Newton
096007c574 Fix zmq crash when calling shutdown with a pending inproc socket connect 2015-08-21 10:06:54 +01:00
Matt Bolger
7e09306cb3 -Set signaler_port to 0 which allows the OS to find a free port, rather than crashing if 5905 is in use (https://github.com/zeromq/libzmq/issues/1542)
-Added config.hpp to the source list so it shows up in generated projects
-Remove CMAKE_BUILD_TYPE setting for generators that don't use it
2015-08-21 13:45:59 +10:00
Joe Eli McIlvain
61217a2686 Problem: Source files contain mixed tabs and spaces.
Solution: Convert to spaces and remove trailing whitespace in these files.
2015-08-20 07:46:34 -07:00
David Jelenc
1240d7ac83 Fixes failing tests regarding XPUB sockets.
Fixes tests that were introduced in a previous pull request. See
https://github.com/zeromq/libzmq/pull/1539#issuecomment-132968987
2015-08-20 15:32:23 +02:00
David Jelenc
b9634e11a3 Addresses zeromq/libzmq#1116.
This patch  adds a new member of type deque to the
xpub class that contains pointers to metadata_t.
This deque is then used (alongside pending_data
and pending_flags) to preserve metadata when
copying messages.
2015-08-20 12:09:56 +02:00
Kapp Arnaud
370b8c9bb1 Problem: Identity frame from router has no metadata
The routing id (identity) frame return when reading from
a router doesn't have the same metadata as the "real"
message that follows.
For example, The ZAP "User-Id" property is missing.

This patch attach the "data message"'s metadata
to the "identity message" when it is read from the router.
2015-08-20 01:15:18 +02:00
somdoron
4da5ff6a7d revert to original zmq_polland creating zmq_pollfd_poll for polling on pollfd 2015-08-17 18:57:47 +03:00
Constantin Rack
a96f16e3fa Merge pull request #1534 from somdoron/master
problem: new poller field in zmq_pollitem_t is changing the api
2015-08-17 13:40:26 +02:00
somdoron
d83b045347 rename poller to pollfd 2015-08-17 14:20:49 +03:00
Constantin Rack
34fe5eaf26 Solution: explicitly set u.base.metadata to null 2015-08-17 12:41:27 +02:00
somdoron
5bae6911af remove poller field, using fd instead 2015-08-17 11:56:23 +03:00
reza.ebrahimi
1621c25ef0 define a macro for heap object deletion in a unified manner (related to issue #1524) 2015-08-17 00:35:11 +04:30
somdoron
6eddbd98bc polling on thread safe sockets 2015-08-16 13:57:28 +03:00
somdoron
a63818904d add methods to handle poller 2015-08-16 13:57:28 +03:00
somdoron
34968771ca add an option to check if the socket is thread safe 2015-08-16 11:50:50 +03:00
reza.ebrahimi
8e6ef4616e changing some camelCase variable names to snake_case in previous commit 2015-08-14 16:56:07 +04:30
reza.ebrahimi
d7b74d1f57 remove unnecessary multiple WSAGetLastError() calls 2015-08-14 16:29:18 +04:30
reza.ebrahimi
bff2284a50 place a ZMQ_UNUSED macro and replace all unused variables with ZMQ_UNUSED macro 2015-08-14 15:40:39 +04:30
Rik van der Heijden
c68e9a39bf Merge fix for zeromq/zeromq4-1#52, getsockopt ZMQ_RCVMORE now resets all bits 2015-08-11 21:37:50 +02:00
KIU Shueng Chuan
e129640471 fix: ZMQ_TCP_RETRANSMIT_TIMEOUT not applied to bind socket 2015-08-07 06:43:31 +08:00
Constantin Rack
84a93d4251 Merge pull request #1511 from sorenh/linger_fix
Avoid terminating connections prematurely
2015-08-06 20:45:45 +02:00
Soren Hansen
abc845d1af Avoid terminating connections prematurely
While sending very large messages (far beyond what fits in a the tcp
buffer, so it takes multiple sendto system calls for it to finish),
zmq_close will close the connection regardless of ZMQ_LINGER.

In case no engine is attached, a pipe->check_read() is needed to look
for the delimiter in the pipe and ultimately trigger the pipe
termination.

However, if there *is* an engine attached, the check_read() looks ahead
and finds the delimiter and terminates the connection even though the
engine might actually still be in the middle of sending a message.

This happens because while the io_thread is still busy sending the data,
the pipe can get terminated and the io thread ends up being terminated.
2015-08-06 20:09:37 +02:00
KIU Shueng Chuan
c7f2cdd699 fix: Windows setsockopt needs char* cast 2015-08-07 00:05:13 +08:00
KIU Shueng Chuan
ca9215de1e add ZMQ_TCP_RETRANSMIT_TIMEOUT socket option 2015-08-06 23:36:27 +08:00
KIU Shueng Chuan
eeb697b5ac add connect timeout logic 2015-08-04 22:17:02 +08:00
KIU Shueng Chuan
c0ca2be642 add ZMQ_CONNECT_TIMEOUT socket option 2015-08-04 22:17:02 +08:00
KIU Shueng Chuan
4a0bde8130 rename timer_started to reconnect_timer_started 2015-08-04 22:17:02 +08:00
Joe Eli McIlvain
438b5207f6 Remove type-pun in zmq.cpp to resolve issue #1500. 2015-08-02 08:27:07 -07:00
Pieter Hintjens
6dfe8f20e2 Merge pull request #1492 from brian-peloton/fix-memory-leak
Fix a documented memory leak.
2015-07-28 22:57:11 +02:00
Brian Silverman
62a0e45089 Fix eventfd read handling under heavy load.
I had the assertion below fail occasionally when running the libzmq
tests under heavy CPU load on linux 3.16.0-4-amd64.
2015-07-28 13:48:36 -07:00
Brian Silverman
97969808f6 Fix a documented memory leak.
Despite the old comments, re-initing the msg_t leaks a refcount to
metadata in some situations.

v1_decoder looks like it isn't tested any more, but it seems like a good
idea to fix it because it has the exact same piece of buggy code
v2_decoder does.
2015-07-28 13:48:13 -07:00
evoskuil
81aa6f45a4 Style and explicitness. 2015-07-26 17:37:38 -07:00
evoskuil
6f0efc092c Make lossy cast explicit. 2015-07-26 17:37:28 -07:00
KIU Shueng Chuan
2182bc963d check for potential unsigned integer wraparound before adding 2015-07-25 17:46:46 +08:00
KIU Shueng Chuan
3e7d737360 change ZMQ_STREAM_NOTIFY to default to 1 2015-07-24 05:21:53 +08:00
KIU Shueng Chuan
518b939f31 make ZMQ_STREAM_NOTIFY also control disconnect notificatons 2015-07-24 05:21:53 +08:00
Ricardo Catalinas Jiménez
ec5592db1f Fix 1478: receive unsubscriptions in XPUB when verbose
Fixes not receiving unsubscription messages in XPUB socket with
ZMQ_XPUB_VERBOSE and using a XSUB-XPUB proxy in front.

This adds two modifications:

- It adds a new flag, ZMQ_XPUB_VERBOSE_UNSUBSCRIBE, to enable verbose
  unsubscription messages, necessary when using a XSUB/XPUB proxy.

- It adds a boolean switch to zmq::mtrie_t::rm () to control if the
  callback is invoked every time or only in the last removal. Necessary
  when a pipe is terminated and the verbose mode for unsubscriptions is
  enabled.
2015-07-23 12:02:34 +01:00
Richard Newton
91877a22d7 Fix windows build 2015-07-23 08:49:03 +01:00
Richard Newton
a4509d8f88 Merge pull request #1484 from pijyoi/fixsmash
fix #1447 Segfault or Abort after PR #1441
2015-07-23 08:26:15 +01:00
Giulio Eulisse
e2be0d25bd Fix compilation on mac. 2015-07-22 21:31:48 +02:00
Brian Silverman
773a06fc23 Fix memory leak when creating a socket fails.
Previously, AddressSanitizer flagged leaks when running
tests/test_many_sockets.cpp.
2015-07-22 11:18:48 -07:00
KIU Shueng Chuan
708353a1b9 advance refcnt only if it was used 2015-07-22 21:19:22 +08:00
Brian Silverman
18791f2bfb Fix several missing msg_t::close calls.
I traced memory leaks found using AddressSanitizer down to these.
2015-07-21 19:42:20 -07:00
Jens Auer
23797120ff Fixed #1477 corruption in "zero-copy" raw_decoder for payloads larger than 8192 bytes #1477
Fixed wrong message::init arguments.
2015-07-20 22:22:13 +02:00
Constantin Rack
311f4d00e4 Merge pull request #1472 from reunanen/allow-explicitly-setting-buf-sizes-to-0
Allow explicitly setting buf sizes to 0
2015-07-08 11:20:45 +02:00
Juha Reunanen
f7b933f570 LIBZMQ-195 allow explicitly setting sndbuf and rcvbuf to 0 (see https://support.microsoft.com/en-us/kb/201213) 2015-07-08 11:31:34 +03:00
Pieter Hintjens
72a94881de Merge pull request #1471 from reunanen/retry-on-WSAENOBUFS
on Windows, handle WSAENOBUFS like WSAEWOULDBLOCK
2015-07-07 21:51:36 +02:00
Pieter Hintjens
adafdb8f4f Merge pull request #1470 from reunanen/check-msg-type-in-rm_refs
add message type sanity check in msg_t::rm_refs
2015-07-07 21:50:35 +02:00
Juha Reunanen
ccb13e1732 add sanity check in msg_t::rm_refs in order to avoid invalid memory access with u.zclmsg.refcnt 2015-07-07 19:31:46 +03:00
Juha Reunanen
8339271a3e LIBZMQ-195 on Windows, handle WSAENOBUFS like WSAEWOULDBLOCK 2015-07-07 13:38:10 +03:00
Thomas Köppe
29b45489fa [decoder.hpp] Fix misspelled inclusion 2015-07-06 00:20:59 +01:00
Thomas Köppe
5b4b8a063b [decoder*] Style fixes for consistency 2015-07-06 00:01:52 +01:00
Jens Auer
ef365151ca - Replaced C-style casts with C++-casts
- Replaced stdlib.h with cstdlib
- Made single-argument constructors explicit
2015-07-05 23:19:41 +02:00
Jens Auer
3679793601 "zero-copy" raw_decoder
A memcpy is eliminated when receiving data on a ZMQ_STREAM socket. Instead
of receiving into a static buffer and then copying the data into the
buffer malloced in msg_t::init_size, the raw_decoder allocates the memory
for together with the reference-counter and creates a msg_t object
on top of that memory. This saves the memcpy operation.

For small messages, data is still copied and the receive buffer is reused.
2015-07-05 16:05:46 +02:00
Thomas Köppe
14d69a312d Clean-up: Rename internal macros consistently. 2015-07-02 17:41:09 +01:00
Thomas Köppe
ddb82a546b atomic_counter.hpp: clean up the clean-up 2015-07-01 09:55:43 +01:00
Thomas Köppe
26e3873f70 Add C++11 support to atomic_counter_t. 2015-07-01 09:55:25 +01:00
Thomas Köppe
73e6a3808f atomic_ptr.h: clean up the clean-up 2015-06-30 22:57:13 +01:00
Thomas Köppe
08f9bf589e Add missing relaxed memory ordering. 2015-06-30 22:26:35 +01:00
Thomas Köppe
68f5926ec6 Add support for <atomic> in C++11 2015-06-30 20:57:38 +01:00
Jonathan Reams
e9a5bc8d1e Fix units and default values for heartbeats options
Set the ZMQ_HEARTBEAT_TIMEOUT to default to the value of
ZMQ_HEARTBEAT_IVL if it's not explicitly set.
Change the units of ZMQ_HEARTBEAT_TTL to milliseconds in the API
and round down to the nearest decisecond so that all the options
are using the same units.
Make the maximum heartbeat TTL match the spec (6553 seconds)
2015-06-26 14:25:58 -04:00
Jonathan Reams
cbb3b176a6 Add ZMTP heartbeats
This commit adds ZMTP connection heartbeats described in
http://rfc.zeromq.org/spec:37/ZMTP.
2015-06-24 13:24:53 -04:00
Marin Atanasov Nikolov
fa3b5d8b03 Typo fix 2015-06-23 14:45:51 +03:00
Constantin Rack
15f9ee19cb Solution: allow brackets in tcp ipv6 address 2015-06-23 08:54:49 +02:00
Jens Auer
e70b5efa0b Reuse buffer when no messages depend on it. 2015-06-14 14:01:04 +02:00
Jens Auer
51cb57e2c9 Fixed wrong handling of shared messages
The shared reference count was not shared but copied. msg_t cannot
store the refcnt itsef but has to store a pointer to an externally
allocated (shared) refcnter. The changes to lmsg are reverted to
use content_t again. Howver, this introduces an allocation in v2_decoder
when creating the message which can be avoided. When allocating the reception
buffer, space is allocated for the maximum number of reference counts
(8192 / max_vsm_size = 8192/64 = 128 zmq:atomic_counter objects). This
increases the buffer by 128*sizeof(atomic_counter) = 128*4 = 512 bytes only.
When creating a message, the refcnt member is set to the address of one of the
pre-allocated atomic_counter_t objects. To do so, a new msg_t type zcmsg
is introduced because msg::copy must discriminate between the message types
when releasing memory.
2015-06-14 13:35:33 +02:00
Jens Auer
dfe1908008 Fixed wrong buffer end detection in v2_decoder.
zero-copy msg_t::init cannot be used when the message exceeds either
the buffer end or the last received byte. To detect this, the buffer
is now resized to the numnber of received bytes.
2015-06-14 13:35:23 +02:00
Kapp Arnaud
8ffd723271 Probably fix build issue on Solaris.
See #1220 recent comments. This change is untested yet seems
safe.
2015-06-13 22:08:14 +02:00
Min RK
158d77d63e don't check POLLOUT for single-socket proxies 2015-06-06 21:05:32 -07:00
Kapp Arnaud
c35971a603 Fix initialization order.
Fixes #1431.
2015-06-07 02:21:32 +02:00
Richard Newton
dc949624e1 Handle infinite hwms properly 2015-06-05 19:06:36 +01:00
Richard Newton
15eecf4cf4 Update high water marking to allow changing high water mark after connection established. 2015-06-05 17:14:55 +01:00
Richard Newton
9f8b8af926 Fail ZMQ_SNDHWM and ZMQ_RCVHWM setsockopt if already connected. 2015-06-05 10:43:40 +01:00
Jens Auer
e9b403a7b1 zero-copy message receive
Construct messages from a reference-counted buffer allocated once
per receive instead of copying the data.
2015-06-03 23:03:14 +02:00
Jens Auer
611e96c701 Allocation-free msg::init_data
With a msg_t size of 64 bytes, it becomes possible to embedd the content_t's members
struct for large messages directly in the msg_t. This saves the dynamic allocation
of content_t obejcts when using msg_t::init_data.

content_t contains a zmq::atomic_counter_t object which is not a POD in C++98
and thus it cannot be used as a member of the union u. To bypass this, C++11
is used which has relaxed rules for POD and atomic_counter is a C++11-POD. An
alternative would have been to make atomic_counter a classical POD by removing
constructors and all private member functions, i.e. have a struct and free functions
to manipulate it.

A new msg_t::init function is added which decides to either to copy the data for size<64 bytes
or use msg_t::init_data to do zero-copy initialization.
2015-06-03 22:44:33 +02:00
Pieter Hintjens
a07244cda2 Merge pull request #1414 from hintjens/master
Problem: source file headers are somewhat confusing about LGPLv3
2015-06-02 23:40:52 +02:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
ALEKSANDR MELNIKOV
1eb8e2a69f HPUX build and gmake check issues solution (#1412) 2015-06-02 20:17:15 +06:00
Rik van der Heijden
aa2e74c2a2 Fix another degradation, CPU maxes out when POLLOUT is set because poll exits on POLLOUT and doesn't wait for POLLIN. 2015-05-27 14:27:53 +02:00
Rik van der Heijden
ae630cf3eb Fix degradation from #1382, POLLOUT was tested but not requested 2015-05-24 22:39:36 +02:00
Constantin Rack
8a3296c1aa Solution: add missing brackets 2015-05-23 23:18:10 +02:00
Brian Knox
537626258f remove temp printf from stream_engine 2015-05-19 09:38:53 -04:00
Peter Korsgaard
e89577d30c libzmq: Fix pkg-config files for static linking
Libzmq uses C++ standard library features, so users of it should link
against that as well when statically linking.

Add it to Libs.private so users using pkg-config automatically gets the
correct linker flags.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-05-13 08:01:34 +02:00
Pieter Hintjens
eead3bc661 Merge pull request #1388 from rikvdh/issue-1382
Fix for issue #1382
2015-05-01 11:18:56 +02:00
Rik van der Heijden
7b9e9b838d Issue #1382: Do not send data to backend when there are no listeners (+ tests) 2015-05-01 10:39:29 +02:00
Martin Hurton
2e06737bf4 pub: Don't delay pipe termination 2015-04-28 07:48:54 +02:00
Martin Hurton
09a65c5598 push: Don't delay pipe termination 2015-04-28 07:48:04 +02:00
somdoron
c2dcc80602 change minimum version to windows vista and implement dummy condition variable for lower versions 2015-04-26 09:16:01 +03:00
evoskuil
30bd7c481e Fix integer narrowing issues. 2015-04-21 22:26:32 -07:00
Pieter Hintjens
594e3dcceb Problem: shutdown asserts if WSASTARUP wasn't done previously
This is a silly assertion that causes problems if libzmq.dll is
called in some esoteric ways.

Solution: if the shutdown code detects WSANOTINITIALISED, then
exit silently.

Fixes #1377
Fixes #1144
2015-04-20 12:53:37 +02:00
Pieter Hintjens
f053854e51 Merge pull request #1360 from hurtonm/master
Adjust number of sent messages on hiccups
2015-02-19 22:09:58 +01:00
Martin Hurton
5ed6ac60e2 Adjust number of sent messages on hiccups
Not adjusting the sent message count may lead to situation when SUB
socket does not forward its subscriptions.
2015-02-19 21:47:26 +01:00
Thomas Rodgers
700f7bfede resolve #1347 addresses issue of no metadata on identity frame 2015-02-19 13:22:32 -06:00
Thomas Rodgers
4b948b1f3b Code cleanup 2015-02-18 21:24:57 -06:00
Thomas Rodgers
cf0804bb7c Remove unused include 2015-02-18 21:10:50 -06:00