Commit Graph

58 Commits

Author SHA1 Message Date
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
KIU Shueng Chuan
7f22995e35 use mutex implementation if fixed signaler_port!=5905 2013-12-12 00:39:01 +08:00
KIU Shueng Chuan
bd41087ab9 make win32 signaler support ephemeral ports 2013-11-28 18:25:28 +08:00
KIU Shueng Chuan
7bd0b6ada1 remove all asserts during critical section
the size of the critical section is reduced by only entering the critical
section right before the bind().
2013-11-12 01:12:24 +08:00
KIU Shueng Chuan
cf8ba925b4 return error to caller on bind error 2013-11-12 00:07:06 +08:00
Bruno D. Rodrigues
750426037d Fix socket creation above sistem limits for all 'other' OS not covered by eventfd, windows or vms; enhanced test to create sockets up to a bigger limit to really test hitting the OS limit 2013-11-10 10:19:19 +00:00
Pieter Hintjens
51f8571933 Simplified fdpair reset after fork 2013-11-07 15:30:25 +01:00
Pieter Hintjens
2be70dca1a Simplified error handling for make_fdpair on Windows 2013-11-07 15:26:56 +01:00
Pieter Hintjens
c573f6b812 Fix for issue 574 2013-11-07 14:59:53 +01:00
Matt Connolly
c3adc86d6b Fix unused variable when using eventfd 2013-09-02 06:49:30 +10: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
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
57f84d6811 Windows CE support : some more #if !defined _WIN32_WCE
- Windows CE does not manage security attributes (no SetSecurityDescriptorDacl(), SetEvent (NULL, xxx) ...)
- Windows CE does not inheritance of sockets for child process (SetHandleInformation ((HANDLE) *w_, HANDLE_FLAG_INHERIT...)
- see comments about story "Porting ZeroMQ to Windows Mobile" on webpage http://www.zeromq.org/story:5
2013-02-19 18:57:12 +01:00
KIU Shueng Chuan
8c71ac47e8 release critical section on failure to create signaler fdpair 2013-02-15 10:45:43 +08:00
Pieter Hintjens
949d157897 Merge pull request #492 from arsenm/master
Make CMake build usable for other systems
2013-01-02 00:32:15 -08:00
Matt Arsenault
f770954d30 Fix a couple more warnings 2013-01-02 03:24:11 -05:00
Matt Arsenault
6ecb796e77 Fix warnings with MinGW 2013-01-02 03:24:11 -05:00
KIU Shueng Chuan
151a80619b set SO_LINGER on first signaler socket to close in order to avoid
TIME_WAIT state.
2012-12-29 18:05:15 +08:00
KIU Shueng Chuan
942c654d1c win32: close zmq-signaler-port-sync event object to avoid handle leak 2012-12-27 21:31:12 +08:00
Pieter Hintjens
4ba34c9d70 Whitespace and style fixes 2012-10-24 09:18:52 +09:00
Matthew Metnetsky
a0eb0bb7e6 signaler.cpp's Windows Lock should be in the "Global" namespace
That way it can be used more appropriately between processes.
2012-07-26 13:55:27 -04:00
Matthew Metnetsky
83537916f8 Fix issue 335
By assigning a SECURITY_DESCRIPTOR to the event we gain the ability to
share it between service and console programs. We also added
EVENT_MODIFY_STATE as a requirement to OpenEvent so we can SetEvent later
in the method.
2012-07-26 13:52:38 -04:00
Ian Barber
eb14890d23 Revert "Revert "Merge branch 'master' of github.com:ianbarber/libzmq""
This reverts commit 029d3dfae2.
2012-06-12 14:43:18 +01:00
Ian Barber
029d3dfae2 Revert "Merge branch 'master' of github.com:ianbarber/libzmq"
This reverts commit 3345902979, reversing
changes made to 889b0e6f29.
2012-06-12 14:13:17 +01:00
Martin Hurton
1f53697211 Use struct keyword consistently with sockaddr and sockaddr_in 2012-06-10 02:29:49 +02:00
Martin Hurton
24b79c7e0b Prefer errno_assert/alloc_assert to zmq_assert 2012-05-28 23:17:03 +02:00
unknown
5fe6ddfda3 On Windows, preventing sockets to be inherited by child processes. 2012-05-07 15:46:55 +02:00
Martin Hurton
cfa6f4bf51 Fix issue #335
The CreateEvent function requests EVENT_ALL_ACCESS access rights
when the event object already exists. This causes problems
when the event object is created from a service.
The solution is to call OpenEvent function when the CreateEvent
failed due to access control.
The proper solution would be to use CreateEventEx function, but
this one is not available on Windows XP.
2012-04-11 11:41:10 +02:00
boris@boressoft.ru
318ba8836f Add WinCE support.
* Added two new files: errno.hpp and errno.cpp. They are required to use errno functionality on WM.
* zmq.cpp, msg.h: removed inclusion of errno.h because it is included in zmq.h that is also included by .cpp.
* windows.hpp: process.h is included only for desktop builds.
* thread.cpp: on CE CreateThread is used instead of __beginthreadex
* socket_base.cpp, clock.cpp: on CE include cmnintrin.h instead on intrin.h
* signaler.cpp: on Windows should use special macro around event name (for unicode builds)
* err.hpp: make it include errno.hpp (my file) instead on errno.h when building for CE
* err.cpp: use FormatMessage when building for CE (because CE does not have ANSI API functions)
* zmq.h: do not include errno.h whe building for CE
* libzmq.vcproj: add tro new files
2012-03-14 19:12:28 +04:00
Martin Sustrik
f8b0055026 Hangup in signaler creation on Windows fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-10 23:38:08 +01:00
Martin Sustrik
05ce301f35 Merge branch 'master' of github.com:zeromq/libzmq 2011-11-04 09:48:25 +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
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
81da391e7e Use single port for creating signalers on Windows
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-29 14:47:41 +02:00
Martin Sustrik
8b7ac4c2a9 Close file descriptors on exec (issue 218)
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>
2011-09-02 15:34:12 +02:00
Martin Sustrik
d5f3628ad0 Different connecters simplified
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-29 09:37:43 +02:00
Steven McCoy
18d8be5e92 Fix pollin on Cygwin.
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bom.com>
2011-07-18 10:54:53 +02:00
Martin Sustrik
f97f50c252 Signaler timeout bug on Windows fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-18 09:41:26 +02:00
Martin Sustrik
8fb9d3c6d0 Merge branch 'master' of github.com:zeromq/libzmq 2011-07-03 15:33:25 +02:00
Martin Sustrik
6ae1be1a12 Race condition in eventfd signaler fixed
recv function on eventfd signaler could accidentally
grab two signals instead of one. Fixed.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03 15:30:31 +02:00
Martin Sustrik
9a9a0cf410 eventfd implementation of the signaler
Eventfd (on Linux) is more efficient that socketpair
for passing simple signals.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03 15:13:57 +02:00
Martin Sustrik
c687c7e61e Fix MSVC build
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03 14:11:33 +02:00
Martin Sustrik
7c0c798120 Command are now stored in ypipes instead of in socketpairs
Storing commands in OS socket buffers caused whole lot of
problems when free space in the buffer ran out. This patch
stores commands in ypipes instead and uses socketpair just
to signal the other thread, ie. at most one byte is stored
in the socketpair at any single instant.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03 13:33:45 +02:00
Martin Sustrik
9da84a5239 signaler renamed to mailbox
For historical reasons queue to transfer commands between
threads was called 'signaler'. Given that it was used to
pass commands rather than signals it was renamed to 'mailbox',
see Erlang mailboxes.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-05 17:39:51 +01:00
Martin Lucina
1b39bcd883 Automatically resize signalling socket buffer if full
If the socketpair used by signaler_t fills up, this can lead to deadlock.
This patch provides partial resolution by attempting to resize SO_SNDBUF on
the writer side, and if that fails we shall at least assert rather than
hang.

I've also refactored the signaler_t code to make the platform-dependent
parts clearer and have tested both the MSG_DONTWAIT and standard POSIX path
in recv.

The Win32 implementation currently does not implement resizing as I'm not
convinced that it's safe, but it will also assert like other platforms if
signaler_t::send() cannot succeed.

The OpenVMS implementation has been carried forward but is untested.

Signed-off-by: Martin Lucina <mato@kotelna.sk>
2010-11-04 17:54:47 +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 Lucina
f90c8d957e Scalability improvements for large amounts of connections
Add signaler_sndbuf_size option to config.hpp which allows the user to
increase the size of the send buffer used by the signalling socketpair.

Implement random backoff for reconnection attempts using a primitive
pseudo-random generation to prevent reconnection storms.

Add wait_before_connect option to config.hpp to allow the user to enable
random delay even on initial connect. Default is false for low latency.

Signed-off-by: Martin Lucina <mato@kotelna.sk>
2010-10-08 17:49:40 +02:00
Martin Sustrik
91ea204644 EINTR returned from the blocking functions 2010-09-08 08:39:27 +02:00
Bernd Melchers
8ec0743c75 Fix for signaler_t on HP-UX and AIX platforms 2010-09-02 07:33:57 +02:00
Martin Lucina
6d35e82db4 Fix uninitialized use of nbytes in signaler fix 2010-08-06 12:00:57 +02:00