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

116 Commits

Author SHA1 Message Date
Luca Boccassi
d4c0716473 Problem: indentation should be 4 spaces, no tabs
Solution: fix it
2016-02-21 23:16:44 +00:00
Osiris
b3d5fa63a0 Problem: Several problems found by Coverity Static Analyzer
Solution: The Coverity Static Code Analyzer was used on libzmq code and found
many issues with uninitialized member variables, some redefinition of variables
hidding previous instances of same variable name and a couple of functions
where return values were not checked, even though all other occurrences were
checked (e.g. init_size() return).
2016-02-21 15:49:47 -06:00
Osiris
4a5af9d58b Problem: Precompiled headers not being used
Solution: Phase I - make precompiled.hpp be first file included in every source file
2016-02-18 10:56:52 -06:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Fedor Sheremetyev
bad93c536a Set LWM to half of HWL.
This reduces chances of race between writer deactivation and activation.

Reader sends activation command to writer when number or messages is
multiple of LWM. In situation with high throughput (millions of messages
per second) and correspondingly large HWM (e.g. 10M) the difference
between HWM needs to be large enough - so that activation command is
received before pipe becomes full.
2015-11-24 17:33:38 +00:00
Constantin Rack
e4c06bef18 Problem: check_hwm() has different semantic of 'full' 2015-09-25 11:56:54 +02:00
Constantin Rack
f1358c1243 Problem: duplicate code for hwm check 2015-09-25 11:24:48 +02:00
Constantin Rack
bd923f0fbb Problem: some comments contain typos 2015-09-06 18:46:32 +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
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
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
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
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
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
somdoron
5632b57b4a adds server socket type and routing id to msg 2015-02-02 01:17:37 +02:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Thomas Rodgers
7c0a644625 Remove of ZMQ_IDENTITY_FD socket option
Revert "linking fd to pipe identity via socket option"

This reverts commit fe3e8c5c70dc3fbcb0244c5f4c52dcd71b80f858.

Conflicts:
	include/zmq.h
	src/pipe.hpp
	src/session_base.cpp
2015-01-09 17:28:50 -06:00
Sergey M․
76d86c3fc3 Fix some typos 2014-10-17 04:10:33 +07:00
Martin Hurton
f550d66ae3 Code cleanup 2014-08-14 08:58:01 +02:00
Martin Hurton
228426ac44 Code cleanup 2014-08-12 09:31:19 +02:00
kreuzberger
d9a3cc48d4 do not silently drop messages in publisher if hwm is reached 2014-08-08 19:36:00 +02:00
Stoian Ivanov
fe3e8c5c70 linking fd to pipe identity via socket option 2014-04-30 16:34:55 +03:00
Martin Hurton
a09407829e Fix identity handling for inproc transport
Fixes #872
2014-02-09 21:02:00 +01:00
Eric Cornelius
88a8be8231 Update pipe.cpp 2014-01-15 18:11:13 -05:00
Eric Cornelius
589fa57afa Corrects ypipe initialization when conflate is NOT enabled.
Fixes LIBZMQ-584
2014-01-15 18:08:45 -05:00
Martin Hurton
e46ec31209 Implement socket_base_t::get_credential member function
The get_credential () member function returns
credential for the last peer we received message for.
The idea is that this function is used to implement user-level API.
2014-01-13 00:40:27 +01:00
Martin Hurton
d72ceb93be Make it explicit that the probe function doesn't modify passed message 2014-01-08 08:21:13 +01:00
Martin Hurton
96f5fddc45 Simplify ypipe_t and ypipe_base_t template parameters 2014-01-06 11:34:00 +01:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Richard Newton
b9298823b4 Set hwm on connect socket before bind has happend to just that of connects hwm. 2013-09-15 13:35:44 +01:00
Richard Newton
7841b0dd0f Support high water mark on inproc socket connect before bind. 2013-09-14 17:27:18 +01:00
Ian Barber
436cad37ec fix type on HWM 2013-08-20 22:49:19 +01:00
Ian Barber
a9baa051dd Merge in master changes 2013-08-20 22:48:04 +01:00
danielkr
da4a70d59d Fix indentation 2013-08-19 08:18:20 +03:00
Ian Barber
531d3ebc09 Remove delay options
These were exposed to users, but have subsequently been removed as
sockopts. They are currently only being used by ZAP, so I've moved it to
a simpl function call (actually it's only used in one case even in that,
so there may be a further simplification possible there).
2013-08-18 11:16:21 +01:00
danielkr
daa7a8021f Plug in dbuffer to serve the ZMQ_CONFLATE option
ZMQ_CONFLATE option is passed to pipepair() which creates a usual
ypipe_t or ypipe_conflate_t and plugs it into pipe_t under a common
abstract base.
2013-08-17 23:27:25 +03:00
Martin Hurton
084e8792de Small cleanup in pipe.cpp 2013-06-22 16:15:35 +02:00
Martin Hurton
4e47084dd4 Minor cleanups 2013-06-06 13:28:21 +02:00
Martin Hurton
c3e40736de Rename terminated->pipe_terminated 2013-06-06 13:28:21 +02:00
Martin Hurton
4e4803e07f Rename pipe states to make it more mnemonic 2013-05-28 13:45:20 +02:00
Pieter Hintjens
f0f16505e5 Removed corporate advertisements from source file headers
Copyrights had become ads for Sustrik's corporate sponsors, going against the original
agreement to share copyrights with the community (that agreement was: one line stating
iMatix copyright + one reference to AUTHORS file). The proliferation of corporate ads
is also unfair to the many individual authors. I've removed ALL corporate title from
the source files so the copyright statements can now be centralized in AUTHORS and
source files can be properly updated on an annual basis.
2013-03-12 13:24:57 +01:00
Pieter Hintjens
4ba34c9d70 Whitespace and style fixes 2012-10-24 09:18:52 +09:00
Ian Barber
94835581a4 Remove early return on terminated state
Code as stands breaks shutdown process. It was a bugfix by Arthur to a
bad line which was testing for an impossible state - but afaics we do
actually want to flush in those states. It is possible I am wrong on
that though - if there are any shutdown issues introduced aroudn this
commit I would suggest further investigation around this flushing
behavior.
2012-08-26 15:07:16 +01:00
Arthur O'Dwyer
6347d392fd Fix a bug in pipe_t::flush().
Static analysis says:
src\pipe.cpp(193): error V547: Expression is always false. Probably the '||' operator should be used here.

If flush() is called on a pipe whose state was
"terminated" or "double_terminated", the programmer's
intent was to return immediately. But in fact the
two conditions can never be true simultaneously, so
the early return never happens, and we may try to flush
a terminated pipe anyway.
2012-08-24 16:36:19 -07:00
Ian Barber
72bae207a3 Revert "Rebinding on reconnection to allow for the pipe blocking will set the event sink again, which will cause an assert to be triggered. I have modified that to allow for setting the same sink to be OK. I believe this should be ok - on termination, if a pipe hasn't reconnected, it would just attempt to be erased from the pipes list again, which is reasonable"
This reverts commit 1566091bc6cbf2a69b19243be3906c6d92ac339a.
2012-06-12 14:51:05 +01:00
Ian Barber
b020bd4ba8 Revert "Remove unnecessary extra test in pipe assertion - now we are terminating pipes we don't need to allow the case in which a pipe is rebound to the same sink"
This reverts commit 29f8d9ca15f679132302ca5a9016692c2be1d6b2.
2012-06-12 14:49:44 +01:00
Ian Barber
29f8d9ca15 Remove unnecessary extra test in pipe assertion - now we are terminating pipes we don't need to allow the case in which a pipe is rebound to the same sink 2012-06-04 10:29:44 +01:00
Ian Barber
1566091bc6 Rebinding on reconnection to allow for the pipe blocking will set the event sink again, which will cause an assert to be triggered. I have modified that to allow for setting the same sink to be OK. I believe this should be ok - on termination, if a pipe hasn't reconnected, it would just attempt to be erased from the pipes list again, which is reasonable 2012-06-03 23:27:02 +01:00
Martin Hurton
1788fd396b pipe: code cleanup 2012-04-26 10:01:20 +02:00
Sergey KHripchenko
74ae19ac1f spaces deleted 2012-04-21 18:36:20 +04:00
Martin Hurton
6f47f1281b Do not pass a message to the check_write method
The check_write method does not use the passed message.
The parameter was needed to implement the swap.
As the swap is not supported anymore, it is safe to remove this parameter.
2012-03-28 07:28:42 +02:00
Pieter Hintjens
afe8cd503f Revert "fix warn unused"
- anonymous contributor

This reverts commit 7b7d404269cc9bb28e1954ed38dbeb8f63079fd1.
2012-02-14 18:43:33 -06:00
niXman
7b7d404269 fix warn unused 2012-02-10 13:39:34 +04:00
Martin Sustrik
a4843b65d2 Identities re-introduced
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-04 08:00:47 +01:00
Martin Sustrik
8e21d64c97 Copyright dates adjusted to reflect reality
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 18:06:11 +01:00
Martin Sustrik
7842c71073 LABELS and COMMANDs removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 13:39:54 +01:00
Martin Sustrik
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
770d0bc77c Fix MSVC build
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-23 08:51:48 +02:00
Martin Sustrik
12532c7940 O(1) fair-queueing in XREP implemented
Up to now the complexity of fair-queueing in XREP was O(n).

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-22 16:51:40 +02:00
Martin Sustrik
ab99975ad4 LABEL flag added to the wire format
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-20 11:33:54 +02:00
Martin Sustrik
c80908c469 Bug fixed in pipe termination
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-20 08:21:00 +02:00
Martin Sustrik
00dc0245e6 Race condition in pipe_t fixed.
pipe_t now correctly drops pointer to the underlying pipe when
sending pipe_term_ack command.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-19 11:17:20 +02:00
Martin Sustrik
a24a7c15a8 Session termination induced by socket fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-31 14:36:51 +02:00
Martin Sustrik
0b59866a84 Patches from sub-forward branch incorporated
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-30 10:07:34 +02:00
Martin Sustrik
718885fdcd Pending messages are delivered even if connection doesn't exist yet
Bug in previous refactoring fixed.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-26 11:30:25 +02:00
Martin Sustrik
87a6490b39 All pipe termination code moved to pipe_t
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-25 10:25:51 +02:00
Martin Sustrik
0f6f7276e3 Move the pipe termination code to socket_base_t
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-23 20:30:01 +02:00
Martin Sustrik
acf0b0e515 Introduces bi-directional pipes
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-05-22 17:26:53 +02:00
Martin Sustrik
e0246e32d7 Message-related functionality factored out into msg_t class.
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-21 22:27:48 +02:00
Martin Sustrik
507718ee1a ZMQ_HWM type changed to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-24 15:43:03 +01:00
Martin Sustrik
8463b4d55e SWAP functionality removed
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-24 12:27:06 +01:00
Martin Sustrik
18b9ebea32 The copyrights in file headers updated.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02 16:30:40 +01:00
Martin Sustrik
43e8868875 Added explicit error message in case of memory exhaustion
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-22 16:23:36 +01:00
Dhammika Pathirana
babdf48aac Fix pipe writer termination
Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
2011-01-07 13:28:35 +01:00
Mikko Koppanen
27e83cc525 Fixes assertion on pipe.cpp:237 when swap fills up.
Fixes swap::full () functionality

Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
2010-12-15 20:10:27 +01:00
Martin Sustrik
b358df9fff Name of "GNU Lesser Public License" corrected.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30 15:08:28 +02:00
Martin Sustrik
7a685b0f88 Clean-up of session termination process
Specifically, shutdown of child objects is initiated *before* termination
handshake with socket object.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-08 17:23:21 +02:00
Martin Lucina
be159b6316 zmq::writer_t: Add missing test for swap 2010-09-13 13:27:48 +02:00
Martin Sustrik
d8b975f4e7 msg_store_t renamed to swap_t 2010-08-28 13:14:45 +02:00
Martin Sustrik
d90b407115 refactoring of pipe/swap interaction 2010-08-28 13:06:58 +02:00
Martin Sustrik
42000d2c4f terminology unified: revive->activate 2010-08-28 10:15:03 +02:00
Martin Sustrik
92923cd40b bug in pipe deactivation fixed 2010-08-28 08:44:12 +02:00
Martin Sustrik
3e97c0fef4 REQ socket implementation is layered on top of XREQ 2010-08-25 15:39:20 +02:00
Martin Sustrik
f77edfce26 Destruction of session is delayed till both in & out pipes are closed 2010-08-25 15:39:20 +02:00
Martin Sustrik
05d908492d WIP: Socket migration between threads, new zmq_close() semantics
Sockets may now be migrated between OS threads; sockets may not be used by
more than one thread at any time. To migrate a socket to another thread the
caller must ensure that a full memory barrier is called before using the
socket from the target thread.

The new zmq_close() semantics implement the behaviour discussed at:

http://lists.zeromq.org/pipermail/zeromq-dev/2010-July/004244.html

Specifically, zmq_close() is now deterministic and while it still returns
immediately, it does not discard any data that may still be queued for
sending. Further, zmq_term() will now block until all outstanding data has
been sent.

TODO: Many bugs have been introduced, needs testing. Further, SO_LINGER or
an equivalent mechanism (possibly a configurable timeout to zmq_term())
needs to be implemented.
2010-08-25 15:39:20 +02:00
Martin Hurton
10533a560b pipe: check_read() should check for message delimiter 2010-07-24 17:33:54 +02:00
Martin Hurton
e1c596b37e Make sure lwm > 0 when hwm > 0 2010-07-24 17:19:47 +02:00
Martin Hurton
fca2e8e8cc Add SWAP support 2010-06-21 15:06:51 +02:00
Martin Hurton
10c28c1fc2 Revive reader on pipe termination 2010-06-19 20:51:42 +02:00
Martin Hurton
4777fe4010 pipe: fix bug in rollback() method
The msgs_written variable keeps track how many complete
messages have been written so far. The rollback operation drops all
fragments of the last incomplete message so it shouldn't
change this variable at all.
2010-06-17 13:00:30 +02:00
Martin Sustrik
8408ae066d LWM is computed rather than explicitly specified by user 2010-05-25 15:03:57 +02:00
Martin Sustrik
89783c37d2 incomplete messages can be stored in ypipe 2010-05-19 06:31:57 +02:00
Martin Sustrik
2f219d7c28 ZMQ_TBC renamed to ZMQ_MORE 2010-03-27 21:25:40 +01:00
Martin Sustrik
ed291b0251 multi-part messages work with PUB/SUB 2010-03-27 09:24:38 +01:00
Martin Sustrik
c42343d3f0 pipe_t::rollback removes only unfinished message from the pipe rather than all unflushed messages 2010-03-13 12:34:55 +01:00
Martin Hurton
61ee6fae53 Implement flow control
This commit introduces the necessary changes necessary
for implementing flow control. None of the socket types
implements the flow control yet. The code will crash when
the flow control is enabled and the thw lwm is reached.

The following commits will add flow-control support for
individual socket types.
2010-03-12 11:07:38 +01:00
Martin Lucina
27e2d08449 Restructure language bindings
C and C++ headers moved from bindings/ to include/, bindings/ removed
--with-c and --with-cpp options to configure removed, C and C++ now built
and installed by default
2010-03-11 20:33:27 +01:00
Martin Sustrik
531c6af0d4 message flags added to zmq_msg_t strcuture 2010-03-09 16:56:53 +01:00
Martin Sustrik
e04e2cdbba rollback functionality added to pipe 2010-03-09 08:43:20 +01:00