Commit Graph

85 Commits

Author SHA1 Message Date
Pieter Hintjens
b6e61d72b2 Problem: linger values other than -1 or 0 are unsafe
Solution: set defaults back to infinity, and add new context
option, ZMQ_BLOCKY that the user can set to false to get a
less surprising behavior on context termination. Eg.

    zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
2014-11-17 11:56:59 +01:00
Jonathan Reams
d1881acbdc Clean up after using randombytes from libsodium
When Curve authentication is used, libsodium opens a file
descriptor to /dev/urandom to generate random bytes. When
the ZMQ context terminates, it should ensure that file gets
closed.
2014-08-31 13:30:44 -04:00
Martin Hurton
816299f11c Code cleanup 2014-07-09 14:07:32 +02:00
Martin Hurton
54e0fde1cc Resolve issue #949 2014-07-09 10:02:53 +02:00
Joel Lauener
219310b4f0 Thread scheduling parameters: Use ZMQ context options instead of
environment variables.
2014-07-02 14:41:21 +02:00
Pieter Hintjens
39455c2114 Problem: zmq_ctx_get (ZMQ_MAX_SOCKETS) returns gibberish
Well, not gibberish, but 2^31 on Linux, which is useless. The code
should probably use getrlimit on Linux and other calls depending on
the system. For now I've set the ceiling at 64K.
2014-06-11 18:24:39 +02:00
Richard Newton
c9e86acf61 Set up hwm's before we connect the other end of the pipe in ctx_t::connect_inproc_sockets 2014-06-04 12:13:15 +01:00
Martin Hurton
dd2be381ad Add const qualifier to register_endpoint param 2014-05-23 12:27:01 +02:00
Martin Hurton
3901d94b27 Fix race condition in connecting inproc sockets 2014-05-22 09:09:45 +02:00
Martin Hurton
414fc86b22 Code cleanup
- limit visibility of pending_connection_t
- add const qualifiers
2014-05-21 13:08:15 +02:00
Pieter Hintjens
aad54b2a8b Whitespace fixes 2014-05-16 16:00:37 +02:00
Olaf Mandel
e41c8cba0e Rename ZMQ_MAX_SOCKETS_MAX to ZMQ_SOCKET_LIMIT
As per suggestion by Pieter Hintjens. Also update wording in
zmq_ctx_set manual a bit.
2014-02-14 10:09:19 +01:00
Olaf Mandel
5815b768b9 Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
The new options allows querying the maximum allowed number of sockets.
This is system dependent and cannot be encoded in the include file as a
preprocessor macro: for ZMQ_USE_SELECT, this depends on the FD_SETSIZE
macro at time of library compilation, not at time of include file use.
2014-02-13 15:54:06 +01:00
Richard Newton
12442a3d65 Bind pending connections on terminate outside lock. 2014-02-12 23:45:39 +00:00
Richard Newton
668c42fc26 Fix hang on term when inproc is connected but never bound. 2014-02-12 23:10:23 +00:00
Martin Hurton
a09407829e Fix identity handling for inproc transport
Fixes #872
2014-02-09 21:02:00 +01:00
Pieter Hintjens
40d7ca6a60 Whitespace cleanups 2014-02-03 11:03:59 +01:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Richard Newton
7a510b4b60 Fix formatting. 2013-11-07 17:50:29 +00:00
Richard Newton
568cc1adaa Get maximum number of sockets it can handle from poller_t 2013-11-07 17:46:19 +00:00
Richard Newton
844689ed9a Fix race condition on shutdown 2013-11-06 15:19:04 +00:00
Volodymyr Korniichuk
7a960ff29c useless checks were removed 2013-10-04 21:54:52 +03:00
Richard Newton
7841b0dd0f Support high water mark on inproc socket connect before bind. 2013-09-14 17:27:18 +01:00
Richard Newton
379bcb0881 Send identities when connecting pending sockets. 2013-09-12 21:07:29 +01:00
Richard Newton
7c3496a76a Fix race condition and support multiple socket connects before bind. 2013-09-12 18:09:37 +01:00
Richard Newton
5f20d63665 First attempt at inproc connect before bind 2013-09-12 14:44:44 +01:00
Richard Newton
64e1c181f7 Implement non-blocking shutdown command that unblocks other threads waiting on blocking operations. 2013-09-10 13:30:00 +01:00
Matt Connolly
ff2900fd52 Terminate context in a child process of fork() to replace file descriptors to not interfere with parent process's context 2013-09-01 20:42:15 +10:00
Gonzalo Diethelm
3b355fec9a Introduced private constants for the context sanity tag values.
Ignored more MSVC intermmediate files.
2013-06-20 12:43:32 -04: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
Sébastien Rombauts
927000fe2f Fixed 7 MSVC2008 Compiler Warning (level 3) C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
- added explicit test "(xxx != 0)" to get a "bool" value out of the "int" expression
- see the MSDN recommandation http://msdn.microsoft.com/en-us/library/b6801kcy(v=vs.90).aspx
2013-02-19 14:27:14 +01:00
Pieter Hintjens
8ab3c4a1bf Fixed issue #500 2013-01-31 21:52:30 +01:00
Lourens Naudé
759d453368 Significantly reworked the monitoring infrastructure with a more granular per socket API and to play well with monitoring endpoints in application threads 2012-09-21 12:53:31 +01:00
Ian Barber
8bf541b252 Fixing incorrect argument order on va_start
Compile was failing on the monitor_event function function due to the
va_start params being switched.
2012-08-26 14:24:50 +01:00
Arthur O'Dwyer
7fadd708a0 Fix monitor_event() to work at all.
There are three versions of monitor_event(), all taking
variadic arguments. The original code just has the first one
creating a va_list and passing that va_list variadically to
the second one... which creates a new va_list and passes it
variadically to the third one... and of course everything
blows up when we try to pull a non-va_list argument off the
stack.

The correct approach matches the C standard library's use
of printf/vprintf, scanf/vscanf, and so on. Once you make
a va_list, you must pass it only to functions which expect
a va_list parameter.
2012-08-24 16:42:31 -07:00
Martin Hurton
24b79c7e0b Prefer errno_assert/alloc_assert to zmq_assert 2012-05-28 23:17:03 +02:00
Lourens Naudé
f27c02d01e Change context monitor_event prototype to accept a va_list instead 2012-05-21 21:22:16 +01:00
Lourens Naudé
4767159f39 Initial stab at a context level monitor callback and registration API 2012-05-21 20:47:11 +01:00
Pieter Hintjens
9728706b10 Added optval checking in zmq_ctx_set 2012-03-29 07:46:46 -05:00
Pieter Hintjens
75809b27da Fixed issue LIBZMQ-345 - race condition in ctx.socket/term allows segfault 2012-03-22 11:04:01 -05:00
Martin Hurton
151d0717bb Minor cleanups
* corrects whitespace errors
* fixes spelling errors in comments
* prefers #ifdef to #if defined
2012-03-22 07:47:39 +01:00
Martin Hurton
ae2b938330 register_endpoint: simplify locking 2012-03-22 07:47:39 +01:00
Martin Hurton
e56f698023 choose_io_thread: do not assert when no I/O thread was chosen 2012-03-22 07:47:39 +01:00
Martin Hurton
f944336ee0 Fix race condition in find_endpoint 2012-03-22 07:47:38 +01:00
Pieter Hintjens
6e71a54b1e Fixed issues #337, #341, and #340
* Implemented new ctx API (_new, _destroy, _get, _set)
* Removed 'typesafe' macros from zmq.h
* Added support for MAX_SOCKETS (was tied into change for #337)
* Created new man pages
2012-03-19 19:41:20 -05:00
Pieter Hintjens
bdefa181ed Fixed issue 336 2012-03-19 16:15:09 -05:00
Pieter Hintjens
06dd31c56a Removed last vestiges of thread-safe sockets 2012-03-19 15:50:53 -05:00
Pieter Hintjens
afe8cd503f Revert "fix warn unused"
- anonymous contributor

This reverts commit 7b7d404269.
2012-02-14 18:43:33 -06:00
niXman
7b7d404269 fix warn unused 2012-02-10 13:39:34 +04:00
skaller
520ad3c2d7 Set and arrange propagation of thread safe sockets flag.
We use a distinct context initialisation function to specify
all sockets derived therefrom will be thread safe.

However the inheritance is done exclusively in the C interface.
This is not really correct, but it is chosen to minimise
interference with the existing C++ code, including any
construct or other calls within the C++ code base.
Semantically the C++ code should be unchanged,
physically some data structures and extra methods are
provided by they're only used from the C binding.
2012-02-04 02:17:35 +11:00