When zmq::req_t::xrecv detects that a response has no request ID
label, or the ID is the wrong size, it would return an EAGAIN, but
would not discard the remainder of the message. This could allow the
remainder of the message to incorrectly "leak" into a future response,
if it is crafted to look like a reply with a valid response ID.
Discard all remaining message blocks, if the ID is invalid in any way.
This patch changes the Win32 version to call RaiseException instead of abort
(which eventually calls TerminateProcess). This allows crash dumps to be sent
correctly instead of the process disappearing.
Signed-off-by: Paul Betts <paul@paulbetts.org>
This patch is meant to prevent users from running out of memory
when using 0MQ in the default configuration.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
It was accidently lost in commit fcfad5682e, equivalent
to commits 2ddb106 & b62dd40 in version 2.1. Changes semantics
from TXW_MAX_RATE to ODATA_MAX_RATE.
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Aside of fixing couple of corner cases this patch turns the 'match'
function in mtrie from recursive to iterative.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This patch adds support for checking messages as they arrive
(as opposed to when they are recv'd by the user) and drop
the connection if they are malformed.
It also uses this new feature to check for validity of inbound
messages in REQ socket.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
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>
If several of the outbound pipes become passive while sending
a single message, the refcount on the message is adjusted
once only, not multiple times. It's an atomic operation so
the cost is not negligible.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
When exec is executed to start a different process image old
0MQ file descriptors could stay open, thus blocking TCP ports
and alike. This patch should solve the problem.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
zmq_msg_t being defined as unsigned char[32] could not be stored
in STL containers. Fixed by this commit.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
On win64 the size of file descriptor is not the same as size of int.
The bug in PGM transport caused a runtime error because of this.
The problem is fixed now.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
The engine was not used exclusively for TCP connections.
Rather it was used to handle any socket with SOCK_STREAM
semantics. The class was renamed to reflect its true function.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Some small changes to prepare a cross-compilation for the Android platform
Signed-off-by: Ghislain Putois <ghpu@infonie.fr>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>