From b593ea30833ad5dcacb9076c988aec31b0cf26ec Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 23 Jan 2012 08:53:57 +0100 Subject: Imported Upstream version 2.1.7 --- AUTHORS | 1 + ChangeLog | 249 ++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 35 +++++++ configure | 20 ++-- doc/zmq.7 | 6 +- doc/zmq_bind.3 | 10 +- doc/zmq_bind.html | 8 +- doc/zmq_bind.txt | 4 +- doc/zmq_close.3 | 10 +- doc/zmq_close.html | 8 +- doc/zmq_close.txt | 4 +- doc/zmq_connect.3 | 10 +- doc/zmq_connect.html | 8 +- doc/zmq_connect.txt | 4 +- doc/zmq_cpp.7 | 6 +- doc/zmq_device.3 | 6 +- doc/zmq_epgm.7 | 6 +- doc/zmq_errno.3 | 6 +- doc/zmq_getsockopt.3 | 10 +- doc/zmq_getsockopt.html | 8 +- doc/zmq_getsockopt.txt | 4 +- doc/zmq_init.3 | 6 +- doc/zmq_inproc.7 | 6 +- doc/zmq_ipc.7 | 6 +- doc/zmq_msg_close.3 | 6 +- doc/zmq_msg_copy.3 | 6 +- doc/zmq_msg_data.3 | 6 +- doc/zmq_msg_init.3 | 6 +- doc/zmq_msg_init_data.3 | 6 +- doc/zmq_msg_init_size.3 | 6 +- doc/zmq_msg_move.3 | 6 +- doc/zmq_msg_size.3 | 6 +- doc/zmq_pgm.7 | 6 +- doc/zmq_poll.3 | 8 +- doc/zmq_poll.html | 6 +- doc/zmq_poll.txt | 2 +- doc/zmq_recv.3 | 10 +- doc/zmq_recv.html | 8 +- doc/zmq_recv.txt | 4 +- doc/zmq_send.3 | 10 +- doc/zmq_send.html | 8 +- doc/zmq_send.txt | 4 +- doc/zmq_setsockopt.3 | 10 +- doc/zmq_setsockopt.html | 8 +- doc/zmq_setsockopt.txt | 4 +- doc/zmq_socket.3 | 6 +- doc/zmq_socket.html | 4 +- doc/zmq_strerror.3 | 6 +- doc/zmq_tcp.7 | 6 +- doc/zmq_term.3 | 8 +- doc/zmq_term.html | 6 +- doc/zmq_term.txt | 2 +- doc/zmq_version.3 | 6 +- include/zmq.h | 5 +- src/ctx.cpp | 9 ++ src/ctx.hpp | 6 ++ src/decoder.cpp | 4 +- src/dist.cpp | 72 +++++++------- src/dist.hpp | 20 ++-- src/err.cpp | 112 +++++++++++----------- src/err.hpp | 12 +++ src/rep.cpp | 21 ++-- src/socket_base.cpp | 9 ++ src/socket_base.hpp | 6 ++ src/tcp_connecter.cpp | 9 +- src/xrep.cpp | 18 +++- src/xrep.hpp | 1 + src/zmq.cpp | 32 +++---- zeromq.spec | 2 +- 69 files changed, 659 insertions(+), 300 deletions(-) diff --git a/AUTHORS b/AUTHORS index 3ca57ce..43768e5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ Tero Marttila Terry Wilson Thijs Terlouw Toralf Wittner +Tore Halvorsen Vitaly Mayatskikh Credits diff --git a/ChangeLog b/ChangeLog index 5a9a3e7..f15734e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,254 @@ # Generated by Makefile. Do not edit. +commit c35f65a82f1dace3a0b9afc5185dc3efc35595b5 +Author: Pieter Hintjens +Date: Thu May 12 12:07:51 2011 +0200 + + Updated NEWS for 2.1.7 + + NEWS | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit dae5a6cb9e589e2471558dc86c55202558e918c2 +Author: Martin Sustrik +Date: Sun May 8 09:03:49 2011 +0200 + + Async connect doesn't fail on WSAENETDOWN + + Signed-off-by: Martin Sustrik + + NEWS | 9 +++- + src/err.cpp | 112 ++++++++++++++++++++++++++----------------------- + src/err.hpp | 12 +++++ + src/tcp_connecter.cpp | 10 ++-- + 4 files changed, 82 insertions(+), 61 deletions(-) + +commit 46738270c22c134b8bbd7546ba4c6864b42f4c75 +Author: Martin Sustrik +Date: Sat Apr 9 09:46:59 2011 +0200 + + Missing ENOTSOCK added on Win32 + + Signed-off-by: Martin Sustrik + + include/zmq.h | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +commit 52318cf705f9b0a73e88b8296d10291f7ba22a86 +Merge: c42d156 141a001 +Author: Pieter Hintjens +Date: Sat May 7 07:23:21 2011 +0200 + + Updated NEWS + +commit c42d156fb94b5131d385f08ff93659ffd2944e21 +Author: Pieter Hintjens +Date: Sat May 7 07:20:10 2011 +0200 + + Updated NEWS + + NEWS | 11 +++++++---- + 1 files changed, 7 insertions(+), 4 deletions(-) + +commit 141a001b046a1206336642b7aa401cbd5e82b826 +Author: Pieter Hintjens +Date: Fri May 6 17:09:36 2011 +0200 + + Updated news for issue 211 + + NEWS | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +commit 9a08c71d7d63544d55620391d12fab4269e3a4df +Author: Pieter Hintjens +Date: Fri May 6 17:03:18 2011 +0200 + + Fixed issue 211 - REP assert on missing envelope + + src/rep.cpp | 21 ++++++++++++++------- + src/xrep.cpp | 12 +++++++++++- + src/xrep.hpp | 1 + + 3 files changed, 26 insertions(+), 8 deletions(-) + +commit ddffe5db3351fbaff6086157e6a351e935d37d2e +Author: Martin Sustrik +Date: Fri May 6 15:51:56 2011 +0200 + + Current pipe pointer in XREP out of range -- fixed. + + Signed-off-by: Martin Sustrik + + src/xrep.cpp | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +commit 96861b9d405663d71926b21843220481ebd33062 +Author: Martin Sustrik +Date: Sat Apr 9 09:35:34 2011 +0200 + + Run-time checking for context & socket validity added + + Signed-off-by: Martin Sustrik + + NEWS | 3 +++ + doc/zmq_bind.txt | 4 ++-- + doc/zmq_close.txt | 4 ++-- + doc/zmq_connect.txt | 4 ++-- + doc/zmq_getsockopt.txt | 4 ++-- + doc/zmq_recv.txt | 4 ++-- + doc/zmq_send.txt | 4 ++-- + doc/zmq_setsockopt.txt | 4 ++-- + doc/zmq_term.txt | 2 +- + src/ctx.cpp | 9 +++++++++ + src/ctx.hpp | 6 ++++++ + src/socket_base.cpp | 9 +++++++++ + src/socket_base.hpp | 6 ++++++ + src/zmq.cpp | 32 ++++++++++++++++---------------- + 14 files changed, 64 insertions(+), 31 deletions(-) + +commit 24a669f96d44acd03e03212e8ad5c32ffa756f53 +Author: Martin Sustrik +Date: Wed May 4 12:43:23 2011 +0200 + + Tore Halvorsen added to the AUTHORS file + + Signed-off-by: Martin Sustrik + + AUTHORS | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +commit 4536f014071dd85c5520057f902e288c65e3cd2b +Author: Tore Halvorsen +Date: Wed May 4 12:41:10 2011 +0200 + + Accessing an iterator after it is accessed is not valid. + + Moving the erase after the access and check agains current_id. + + src/xrep.cpp | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit 8e740d555b5b4383995cb3d81ff44c1e7add2da4 +Author: Pieter Hintjens +Date: Wed May 4 15:52:26 2011 +0200 + + Clarified zmq_poll man page that timeout resolution is 1msec + + NEWS | 1 + + doc/zmq_poll.txt | 2 +- + 2 files changed, 2 insertions(+), 1 deletions(-) + +commit 71cb36d04bd74ca82aca3868e665831733995be7 +Author: Pieter Hintjens +Date: Tue May 3 17:30:21 2011 +0200 + + Fixed issue 206 + + NEWS | 2 ++ + src/decoder.cpp | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +commit 0fc54c9d14c8ff137e2b8aff6e472dcefb3a0c02 +Author: Pieter Hintjens +Date: Mon May 2 20:09:11 2011 +0200 + + Updated NEWS + + NEWS | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +commit 16b725ddc978633b6349eb9353263c076ad9b702 +Author: Martin Sustrik +Date: Mon May 2 19:28:51 2011 +0200 + + Current inpipe remains unchaged in XREP when other pipe terminates + + When an inpipe terminated within XREP, it was erased from the array + and thus current_in (which is an index) pointed to a different + element in the array. This caused problems when we were in the + middle of reading a multipart message. + + Signed-off-by: Martin Sustrik + + src/xrep.cpp | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +commit c688f7536ea1a2f4f8d82fcc40f962bea230dd9e +Author: Pieter Hintjens +Date: Sat Apr 30 09:13:28 2011 +0200 + + Another fix to PUB sockets with multipart messages + + src/dist.cpp | 18 ++++++++---------- + 1 files changed, 8 insertions(+), 10 deletions(-) + +commit 10f0e7c71ed31530d3a56f9ae99ef926bfcb1090 +Author: Pieter Hintjens +Date: Sat Apr 30 07:37:17 2011 +0200 + + Updated NEWS for issue 191 + + NEWS | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +commit 24e56e19a82035950dd721bb9d970294f508737e +Merge: 33018b3 b6befaa +Author: Pieter Hintjens +Date: Sat Apr 30 07:36:30 2011 +0200 + + Merge branch 'issue191' + +commit b6befaad5d9ac6c4ccb13b1668b14696d7016c01 +Author: Pieter Hintjens +Date: Sat Apr 30 07:36:16 2011 +0200 + + Message atomicity in pub sockets fixed - issue 191 + + src/dist.cpp | 4 +++- + src/dist.hpp | 3 --- + 2 files changed, 3 insertions(+), 4 deletions(-) + +commit 33018b30287777bf19ac292e38861b0c4b7e2599 +Author: Pieter Hintjens +Date: Fri Apr 29 09:24:16 2011 +0200 + + Updated NEWS + + NEWS | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +commit 7dc87c59ded306970763c928ff0c4c350e2a2453 +Author: Martin Sustrik +Date: Fri Apr 29 07:23:30 2011 +0200 + + WSAENETUNREACH is a valid networking error + + Till now, 0MQ asserted on Windows when connect () returned + WSAENETUNREACH. + + Signed-off-by: Martin Sustrik + + src/tcp_connecter.cpp | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +commit be403bf2ba1b61355cd0d2f8f6609408b71cde99 +Author: Pieter Hintjens +Date: Fri Apr 29 09:22:29 2011 +0200 + + Downstreamed patch for issue 191 + + src/dist.cpp | 70 ++++++++++++++++++++++++++++++--------------------------- + src/dist.hpp | 17 +++++++------ + 2 files changed, 46 insertions(+), 41 deletions(-) + +commit 0ec42592f31faa5e98faa38961ee736d892e0783 +Author: Pieter Hintjens +Date: Tue Apr 26 19:57:16 2011 +0200 + + Bumped version number for 2.1.7 + + include/zmq.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + commit ee185e241ec2a3091b9200cd5615cfa4f66e7a07 Author: Pieter Hintjens Date: Tue Apr 26 19:45:25 2011 +0200 diff --git a/NEWS b/NEWS index 3ad869d..8fc0892 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,37 @@ +0MQ version 2.1.7 (Stable), released on 2011/05/12 +================================================== + +Bug fixes +--------- + +* Fixed issue 191, message atomicity issue with PUB sockets (an old issue). + +* Fixed issue 199 (affected ROUTER/XREP sockets, an old issue). + +* Fixed issue 206, assertion failure in zmq.cpp:223, affected all sockets + (bug was introduced in 2.1.6 as part of message validity checking). + +* Fixed issue 211, REP socket asserted if sent malformed envelope (old issue + due to abuse of assertions for error checking). + +* Fixed issue 212, reconnect failing after resume from sleep on Windows + (due to not handling WSAENETDOWN). + +* Properly handle WSAENETUNREACH on Windows (e.g. if client connects + before server binds). + +Changes +------- + +* Runtime checking of socket and context validity, to catch e.g. using a + socket after closing it, or passing an invalid pointer to context/socket + methods. + +* Test cases moved off port 5555, which conflicts with other services. + +* Clarified zmq_poll man page that the resolution of the timeout is 1msec. + + 0MQ version 2.1.6 (Stable), released on 2011/04/26 ================================================== @@ -30,6 +64,7 @@ Note that this version contained a malformed patch and is not usable. It is not available for download, but is available in the git via the 2.1.5 tag. + 0MQ version 2.1.4 (Stable), released on 2011/03/30 ================================================== diff --git a/configure b/configure index 8453dc1..1344c83 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for zeromq 2.1.6. +# Generated by GNU Autoconf 2.67 for zeromq 2.1.7. # # Report bugs to . # @@ -701,8 +701,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='zeromq' PACKAGE_TARNAME='zeromq' -PACKAGE_VERSION='2.1.6' -PACKAGE_STRING='zeromq 2.1.6' +PACKAGE_VERSION='2.1.7' +PACKAGE_STRING='zeromq 2.1.7' PACKAGE_BUGREPORT='zeromq-dev@lists.zeromq.org' PACKAGE_URL='' @@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures zeromq 2.1.6 to adapt to many kinds of systems. +\`configure' configures zeromq 2.1.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of zeromq 2.1.6:";; + short | recursive ) echo "Configuration of zeromq 2.1.7:";; esac cat <<\_ACEOF @@ -1659,7 +1659,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -zeromq configure 2.1.6 +zeromq configure 2.1.7 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2414,7 +2414,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by zeromq $as_me 2.1.6, which was +It was created by zeromq $as_me 2.1.7, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -3233,7 +3233,7 @@ fi # Define the identity of the package. PACKAGE='zeromq' - VERSION='2.1.6' + VERSION='2.1.7' cat >>confdefs.h <<_ACEOF @@ -19405,7 +19405,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by zeromq $as_me 2.1.6, which was +This file was extended by zeromq $as_me 2.1.7, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19471,7 +19471,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -zeromq config.status 2.1.6 +zeromq config.status 2.1.7 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/doc/zmq.7 b/doc/zmq.7 index b5f0d27..60394d0 100644 --- a/doc/zmq.7 +++ b/doc/zmq.7 @@ -2,12 +2,12 @@ .\" Title: zmq .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_bind.3 b/doc/zmq_bind.3 index 8412806..ce589e9 100644 --- a/doc/zmq_bind.3 +++ b/doc/zmq_bind.3 @@ -2,12 +2,12 @@ .\" Title: zmq_bind .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_BIND" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_BIND" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -114,11 +114,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEMTHREAD\fR diff --git a/doc/zmq_bind.html b/doc/zmq_bind.html index 11b8762..034113d 100644 --- a/doc/zmq_bind.html +++ b/doc/zmq_bind.html @@ -690,11 +690,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -738,8 +738,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_bind.txt b/doc/zmq_bind.txt index 6492d9e..06fd79c 100644 --- a/doc/zmq_bind.txt +++ b/doc/zmq_bind.txt @@ -56,8 +56,8 @@ The requested 'address' was not local. The requested 'address' specifies a nonexistent interface. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EMTHREAD*:: No I/O thread is available to accomplish the task. diff --git a/doc/zmq_close.3 b/doc/zmq_close.3 index 43f47b3..86e5666 100644 --- a/doc/zmq_close.3 +++ b/doc/zmq_close.3 @@ -2,12 +2,12 @@ .\" Title: zmq_close .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_CLOSE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_CLOSE" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -56,11 +56,11 @@ The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this b The \fIzmq_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. .SH "ERRORS" .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .SH "SEE ALSO" .sp diff --git a/doc/zmq_close.html b/doc/zmq_close.html index cc13445..015030a 100644 --- a/doc/zmq_close.html +++ b/doc/zmq_close.html @@ -612,11 +612,11 @@ return -1 and set errno to one of the values defined below.

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -637,8 +637,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_close.txt b/doc/zmq_close.txt index 89f9745..47f9bb2 100644 --- a/doc/zmq_close.txt +++ b/doc/zmq_close.txt @@ -34,8 +34,8 @@ return `-1` and set 'errno' to one of the values defined below. ERRORS ------ -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. SEE ALSO diff --git a/doc/zmq_connect.3 b/doc/zmq_connect.3 index 534abb4..1adc6af 100644 --- a/doc/zmq_connect.3 +++ b/doc/zmq_connect.3 @@ -2,12 +2,12 @@ .\" Title: zmq_connect .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_CONNECT" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_CONNECT" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -109,11 +109,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEMTHREAD\fR diff --git a/doc/zmq_connect.html b/doc/zmq_connect.html index daa8fa0..b67ced9 100644 --- a/doc/zmq_connect.html +++ b/doc/zmq_connect.html @@ -676,11 +676,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -724,8 +724,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_connect.txt b/doc/zmq_connect.txt index acd0e9d..1c69631 100644 --- a/doc/zmq_connect.txt +++ b/doc/zmq_connect.txt @@ -54,8 +54,8 @@ The requested 'transport' protocol is not supported. The requested 'transport' protocol is not compatible with the socket type. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EMTHREAD*:: No I/O thread is available to accomplish the task. diff --git a/doc/zmq_cpp.7 b/doc/zmq_cpp.7 index b5fb80a..835da89 100644 --- a/doc/zmq_cpp.7 +++ b/doc/zmq_cpp.7 @@ -2,12 +2,12 @@ .\" Title: zmq_cpp .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_CPP" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_CPP" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_device.3 b/doc/zmq_device.3 index 67ab7bb..eb6d4c4 100644 --- a/doc/zmq_device.3 +++ b/doc/zmq_device.3 @@ -2,12 +2,12 @@ .\" Title: zmq_device .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_DEVICE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_DEVICE" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_epgm.7 b/doc/zmq_epgm.7 index 3c4c7d1..8ee8ef3 100644 --- a/doc/zmq_epgm.7 +++ b/doc/zmq_epgm.7 @@ -2,12 +2,12 @@ .\" Title: zmq_pgm .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_PGM" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_PGM" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_errno.3 b/doc/zmq_errno.3 index 9ebec08..3eeeab8 100644 --- a/doc/zmq_errno.3 +++ b/doc/zmq_errno.3 @@ -2,12 +2,12 @@ .\" Title: zmq_errno .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_ERRNO" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_ERRNO" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_getsockopt.3 b/doc/zmq_getsockopt.3 index 1760fa2..c744803 100644 --- a/doc/zmq_getsockopt.3 +++ b/doc/zmq_getsockopt.3 @@ -2,12 +2,12 @@ .\" Title: zmq_getsockopt .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_GETSOCKOPT" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_GETSOCKOPT" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -896,11 +896,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEINTR\fR diff --git a/doc/zmq_getsockopt.html b/doc/zmq_getsockopt.html index 1c8af72..3c0b0e4 100644 --- a/doc/zmq_getsockopt.html +++ b/doc/zmq_getsockopt.html @@ -1661,11 +1661,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -1705,8 +1705,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_getsockopt.txt b/doc/zmq_getsockopt.txt index 1279fbc..e211d83 100644 --- a/doc/zmq_getsockopt.txt +++ b/doc/zmq_getsockopt.txt @@ -376,8 +376,8 @@ _option_value_, as specified by _option_len_, is insufficient for storing the option value. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EINTR*:: The operation was interrupted by delivery of a signal. diff --git a/doc/zmq_init.3 b/doc/zmq_init.3 index dd0bed5..ea2d43f 100644 --- a/doc/zmq_init.3 +++ b/doc/zmq_init.3 @@ -2,12 +2,12 @@ .\" Title: zmq_init .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_INIT" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_INIT" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_inproc.7 b/doc/zmq_inproc.7 index 0f0ea78..aedbed4 100644 --- a/doc/zmq_inproc.7 +++ b/doc/zmq_inproc.7 @@ -2,12 +2,12 @@ .\" Title: zmq_inproc .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_INPROC" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_INPROC" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_ipc.7 b/doc/zmq_ipc.7 index e3b0652..4aaeffa 100644 --- a/doc/zmq_ipc.7 +++ b/doc/zmq_ipc.7 @@ -2,12 +2,12 @@ .\" Title: zmq_ipc .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_IPC" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_IPC" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_close.3 b/doc/zmq_msg_close.3 index 3201edb..1aa60c6 100644 --- a/doc/zmq_msg_close.3 +++ b/doc/zmq_msg_close.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_close .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_CLOSE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_CLOSE" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_copy.3 b/doc/zmq_msg_copy.3 index 3c19ef3..e820f14 100644 --- a/doc/zmq_msg_copy.3 +++ b/doc/zmq_msg_copy.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_copy .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_COPY" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_COPY" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_data.3 b/doc/zmq_msg_data.3 index e619197..74d4943 100644 --- a/doc/zmq_msg_data.3 +++ b/doc/zmq_msg_data.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_data .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_DATA" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_DATA" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_init.3 b/doc/zmq_msg_init.3 index 8fe45bf..13c3e23 100644 --- a/doc/zmq_msg_init.3 +++ b/doc/zmq_msg_init.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_init .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_INIT" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_INIT" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_init_data.3 b/doc/zmq_msg_init_data.3 index c042a87..91aea9c 100644 --- a/doc/zmq_msg_init_data.3 +++ b/doc/zmq_msg_init_data.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_init_data .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_INIT_DATA" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_INIT_DATA" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_init_size.3 b/doc/zmq_msg_init_size.3 index a0d174d..5a77611 100644 --- a/doc/zmq_msg_init_size.3 +++ b/doc/zmq_msg_init_size.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_init_size .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_INIT_SIZE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_INIT_SIZE" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_move.3 b/doc/zmq_msg_move.3 index e5625f5..4c90bec 100644 --- a/doc/zmq_msg_move.3 +++ b/doc/zmq_msg_move.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_move .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_MOVE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_MOVE" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_msg_size.3 b/doc/zmq_msg_size.3 index 114d7af..e295722 100644 --- a/doc/zmq_msg_size.3 +++ b/doc/zmq_msg_size.3 @@ -2,12 +2,12 @@ .\" Title: zmq_msg_size .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_MSG_SIZE" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_MSG_SIZE" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_pgm.7 b/doc/zmq_pgm.7 index 3c4c7d1..8ee8ef3 100644 --- a/doc/zmq_pgm.7 +++ b/doc/zmq_pgm.7 @@ -2,12 +2,12 @@ .\" Title: zmq_pgm .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_PGM" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_PGM" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_poll.3 b/doc/zmq_poll.3 index 0c6731b..f66aa94 100644 --- a/doc/zmq_poll.3 +++ b/doc/zmq_poll.3 @@ -2,12 +2,12 @@ .\" Title: zmq_poll .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_POLL" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_POLL" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -72,7 +72,7 @@ All 0MQ sockets passed to the \fIzmq_poll()\fR function must share the same 0MQ .sp For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall first clear the \fIrevents\fR member, and then indicate any requested events that have occurred by setting the bit corresponding to the event condition in the \fIrevents\fR member\&. .sp -If none of the requested events have occurred on any \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall wait \fItimeout\fR microseconds for an event to occur on any of the requested items\&. If the value of \fItimeout\fR is 0, \fIzmq_poll()\fR shall return immediately\&. If the value of \fItimeout\fR is \-1, \fIzmq_poll()\fR shall block indefinitely until a requested event has occurred on at least one \fBzmq_pollitem_t\fR\&. +If none of the requested events have occurred on any \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall wait \fItimeout\fR microseconds for an event to occur on any of the requested items\&. If the value of \fItimeout\fR is 0, \fIzmq_poll()\fR shall return immediately\&. If the value of \fItimeout\fR is \-1, \fIzmq_poll()\fR shall block indefinitely until a requested event has occurred on at least one \fBzmq_pollitem_t\fR\&. The resolution of \fItimeout\fR is 1 millisecond\&. .sp The \fIevents\fR and \fIrevents\fR members of \fBzmq_pollitem_t\fR are bit masks constructed by OR\(cqing a combination of the following event flags: .PP diff --git a/doc/zmq_poll.html b/doc/zmq_poll.html index da4b8fb..ffbcbc0 100644 --- a/doc/zmq_poll.html +++ b/doc/zmq_poll.html @@ -623,7 +623,7 @@ bit corresponding to the event condition in the revents member.

timeout is 0, zmq_poll() shall return immediately. If the value of timeout is -1, zmq_poll() shall block indefinitely until a requested event has occurred on at least one -zmq_pollitem_t.

+zmq_pollitem_t. The resolution of timeout is 1 millisecond.

The events and revents members of zmq_pollitem_t are bit masks constructed by OR’ing a combination of the following event flags:

@@ -747,8 +747,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_poll.txt b/doc/zmq_poll.txt index 26d7dac..ee7539b 100644 --- a/doc/zmq_poll.txt +++ b/doc/zmq_poll.txt @@ -48,7 +48,7 @@ _zmq_poll()_ shall wait 'timeout' microseconds for an event to occur on any of the requested items. If the value of 'timeout' is `0`, _zmq_poll()_ shall return immediately. If the value of 'timeout' is `-1`, _zmq_poll()_ shall block indefinitely until a requested event has occurred on at least one -*zmq_pollitem_t*. +*zmq_pollitem_t*. The resolution of 'timeout' is 1 millisecond. The 'events' and 'revents' members of *zmq_pollitem_t* are bit masks constructed by OR'ing a combination of the following event flags: diff --git a/doc/zmq_recv.3 b/doc/zmq_recv.3 index 7a7608e..0df4e82 100644 --- a/doc/zmq_recv.3 +++ b/doc/zmq_recv.3 @@ -2,12 +2,12 @@ .\" Title: zmq_recv .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_RECV" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_RECV" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -89,11 +89,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEINTR\fR diff --git a/doc/zmq_recv.html b/doc/zmq_recv.html index 830f249..db436f0 100644 --- a/doc/zmq_recv.html +++ b/doc/zmq_recv.html @@ -661,11 +661,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -738,8 +738,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_recv.txt b/doc/zmq_recv.txt index f33af29..afbcb9c 100644 --- a/doc/zmq_recv.txt +++ b/doc/zmq_recv.txt @@ -63,8 +63,8 @@ socket types that switch between several states, such as ZMQ_REP. See the _messaging patterns_ section of linkzmq:zmq_socket[3] for more information. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EINTR*:: The operation was interrupted by delivery of a signal before a message was available. diff --git a/doc/zmq_send.3 b/doc/zmq_send.3 index 20de946..ade1b3c 100644 --- a/doc/zmq_send.3 +++ b/doc/zmq_send.3 @@ -2,12 +2,12 @@ .\" Title: zmq_send .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_SEND" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_SEND" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -112,11 +112,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEINTR\fR diff --git a/doc/zmq_send.html b/doc/zmq_send.html index 70c1ebe..0e17363 100644 --- a/doc/zmq_send.html +++ b/doc/zmq_send.html @@ -681,11 +681,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -747,8 +747,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_send.txt b/doc/zmq_send.txt index d61ae75..c99c123 100644 --- a/doc/zmq_send.txt +++ b/doc/zmq_send.txt @@ -73,8 +73,8 @@ socket types that switch between several states, such as ZMQ_REP. See the _messaging patterns_ section of linkzmq:zmq_socket[3] for more information. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EINTR*:: The operation was interrupted by delivery of a signal before the message was sent. diff --git a/doc/zmq_setsockopt.3 b/doc/zmq_setsockopt.3 index 00da7e2..16e64b1 100644 --- a/doc/zmq_setsockopt.3 +++ b/doc/zmq_setsockopt.3 @@ -2,12 +2,12 @@ .\" Title: zmq_setsockopt .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_SETSOCKOPT" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_SETSOCKOPT" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -806,11 +806,11 @@ associated with the specified was terminated\&. .RE .PP -\fBEFAULT\fR +\fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEINTR\fR diff --git a/doc/zmq_setsockopt.html b/doc/zmq_setsockopt.html index 93d0611..de672eb 100644 --- a/doc/zmq_setsockopt.html +++ b/doc/zmq_setsockopt.html @@ -1534,11 +1534,11 @@ The ØMQ context associated with the specified socket was term

-EFAULT +ENOTSOCK

-The provided socket was not valid (NULL). +The provided socket was invalid.

@@ -1595,8 +1595,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_setsockopt.txt b/doc/zmq_setsockopt.txt index 8022568..4a43d65 100644 --- a/doc/zmq_setsockopt.txt +++ b/doc/zmq_setsockopt.txt @@ -334,8 +334,8 @@ The requested option _option_name_ is unknown, or the requested _option_len_ or _option_value_ is invalid. *ETERM*:: The 0MQ 'context' associated with the specified 'socket' was terminated. -*EFAULT*:: -The provided 'socket' was not valid (NULL). +*ENOTSOCK*:: +The provided 'socket' was invalid. *EINTR*:: The operation was interrupted by delivery of a signal. diff --git a/doc/zmq_socket.3 b/doc/zmq_socket.3 index a6b9ebe..7fc7d1c 100644 --- a/doc/zmq_socket.3 +++ b/doc/zmq_socket.3 @@ -2,12 +2,12 @@ .\" Title: zmq_socket .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_SOCKET" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_SOCKET" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_socket.html b/doc/zmq_socket.html index a5ec995..d688fa9 100644 --- a/doc/zmq_socket.html +++ b/doc/zmq_socket.html @@ -1416,8 +1416,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_strerror.3 b/doc/zmq_strerror.3 index 6bf0d5c..dfeaa3f 100644 --- a/doc/zmq_strerror.3 +++ b/doc/zmq_strerror.3 @@ -2,12 +2,12 @@ .\" Title: zmq_strerror .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_STRERROR" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_STRERROR" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_tcp.7 b/doc/zmq_tcp.7 index 58e6360..5f2f6df 100644 --- a/doc/zmq_tcp.7 +++ b/doc/zmq_tcp.7 @@ -2,12 +2,12 @@ .\" Title: zmq_tcp .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_TCP" "7" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_TCP" "7" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zmq_term.3 b/doc/zmq_term.3 index 5c94bea..f7f3b4b 100644 --- a/doc/zmq_term.3 +++ b/doc/zmq_term.3 @@ -2,12 +2,12 @@ .\" Title: zmq_term .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/07/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_TERM" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_TERM" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -109,7 +109,7 @@ The \fIzmq_term()\fR function shall return zero if successful\&. Otherwise it sh .RS 4 The provided \fIcontext\fR -was not valid (NULL)\&. +was invalid\&. .RE .PP \fBEINTR\fR diff --git a/doc/zmq_term.html b/doc/zmq_term.html index 590897a..db7b9d2 100644 --- a/doc/zmq_term.html +++ b/doc/zmq_term.html @@ -635,7 +635,7 @@ return -1 and set errno to one of the values defined below.

-The provided context was not valid (NULL). +The provided context was invalid.

@@ -664,8 +664,8 @@ Martin Lucina <mato@kotelna.sk>.

<

diff --git a/doc/zmq_term.txt b/doc/zmq_term.txt index c7e13d7..577de3d 100644 --- a/doc/zmq_term.txt +++ b/doc/zmq_term.txt @@ -46,7 +46,7 @@ return `-1` and set 'errno' to one of the values defined below. ERRORS ------ *EFAULT*:: -The provided 'context' was not valid (NULL). +The provided 'context' was invalid. *EINTR*:: Termination was interrupted by a signal. It can be restarted if needed. diff --git a/doc/zmq_version.3 b/doc/zmq_version.3 index 10e27d4..0acf575 100644 --- a/doc/zmq_version.3 +++ b/doc/zmq_version.3 @@ -2,12 +2,12 @@ .\" Title: zmq_version .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/20/2011 +.\" Date: 05/06/2011 .\" Manual: 0MQ Manual -.\" Source: 0MQ 2.1.5 +.\" Source: 0MQ 2.1.6 .\" Language: English .\" -.TH "ZMQ_VERSION" "3" "04/20/2011" "0MQ 2\&.1\&.5" "0MQ Manual" +.TH "ZMQ_VERSION" "3" "05/06/2011" "0MQ 2\&.1\&.6" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/include/zmq.h b/include/zmq.h index a7b20b3..5857ba8 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -55,7 +55,7 @@ extern "C" { /* Version macros for compile-time API version detection */ #define ZMQ_VERSION_MAJOR 2 #define ZMQ_VERSION_MINOR 1 -#define ZMQ_VERSION_PATCH 6 +#define ZMQ_VERSION_PATCH 7 #define ZMQ_MAKE_VERSION(major, minor, patch) \ ((major) * 10000 + (minor) * 100 + (patch)) @@ -98,6 +98,9 @@ ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); #ifndef EINPROGRESS #define EINPROGRESS (ZMQ_HAUSNUMERO + 8) #endif +#ifndef ENOTSOCK +#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) +#endif /* Native 0MQ error codes. */ #define EFSM (ZMQ_HAUSNUMERO + 51) diff --git a/src/ctx.cpp b/src/ctx.cpp index 9cbb9de..2758729 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -36,6 +36,7 @@ #endif zmq::ctx_t::ctx_t (uint32_t io_threads_) : + tag (0xbadcafe0), terminating (false) { int rc; @@ -78,6 +79,11 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) : zmq_assert (rc == 0); } +bool zmq::ctx_t::check_tag () +{ + return tag == 0xbadcafe0; +} + zmq::ctx_t::~ctx_t () { // Check that there are no remaining sockets. @@ -99,6 +105,9 @@ zmq::ctx_t::~ctx_t () // needed as mailboxes themselves were deallocated with their // corresponding io_thread/socket objects. free (slots); + + // Remove the tag, so that the object is considered dead. + tag = 0xdeadbeef; } int zmq::ctx_t::terminate () diff --git a/src/ctx.hpp b/src/ctx.hpp index c6ea4ce..33d5dad 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -60,6 +60,9 @@ namespace zmq // of I/O thread pool to create. ctx_t (uint32_t io_threads_); + // Returns false if object is not a context. + bool check_tag (); + // This function is called when user invokes zmq_term. If there are // no more sockets open it'll cause all the infrastructure to be shut // down. If there are open sockets still, the deallocation happens @@ -98,6 +101,9 @@ namespace zmq ~ctx_t (); + // Used to check whether the object is a context. + uint32_t tag; + // Sockets belonging to this context. We need the list so that // we can notify the sockets when zmq_term() is called. The sockets // will return ETERM then. diff --git a/src/decoder.cpp b/src/decoder.cpp index c9a7dc9..84ecd92 100644 --- a/src/decoder.cpp +++ b/src/decoder.cpp @@ -109,11 +109,11 @@ bool zmq::decoder_t::eight_byte_size_ready () bool zmq::decoder_t::flags_ready () { // Store the flags from the wire into the message structure. - in_progress.flags = tmpbuf [0]; + in_progress.flags = tmpbuf [0] | ~ZMQ_MSG_MASK; next_step (zmq_msg_data (&in_progress), zmq_msg_size (&in_progress), &decoder_t::message_ready); - + return true; } diff --git a/src/dist.cpp b/src/dist.cpp index e447bc1..d74e69f 100644 --- a/src/dist.cpp +++ b/src/dist.cpp @@ -25,9 +25,11 @@ #include "err.hpp" #include "own.hpp" #include "msg_content.hpp" +#include "likely.hpp" zmq::dist_t::dist_t (own_t *sink_) : active (0), + eligible (0), more (false), sink (sink_), terminating (false) @@ -41,20 +43,24 @@ zmq::dist_t::~dist_t () void zmq::dist_t::attach (writer_t *pipe_) { - // If we are in the middle of sending a message, let's postpone plugging - // in the pipe. - if (!terminating && more) { - new_pipes.push_back (pipe_); - return; - } - pipe_->set_event_sink (this); - pipes.push_back (pipe_); - pipes.swap (active, pipes.size () - 1); - active++; + // If we are in the middle of sending a message, we'll add new pipe + // into the list of eligible pipes. Otherwise we add it to the list + // of active pipes. + if (more) { + pipes.push_back (pipe_); + pipes.swap (eligible, pipes.size () - 1); + eligible++; + } + else { + pipes.push_back (pipe_); + pipes.swap (active, pipes.size () - 1); + active++; + eligible++; + } - if (terminating) { + if (unlikely (terminating)) { sink->register_term_acks (1); pipe_->terminate (); } @@ -72,21 +78,30 @@ void zmq::dist_t::terminate () void zmq::dist_t::terminated (writer_t *pipe_) { - // Remove the pipe from the list; adjust number of active pipes - // accordingly. + // Remove the pipe from the list; adjust number of active and/or + // eligible pipes accordingly. if (pipes.index (pipe_) < active) active--; + if (pipes.index (pipe_) < eligible) + eligible--; pipes.erase (pipe_); - if (terminating) + if (unlikely (terminating)) sink->unregister_term_ack (); } void zmq::dist_t::activated (writer_t *pipe_) { - // Move the pipe to the list of active pipes. - pipes.swap (pipes.index (pipe_), active); - active++; + // Move the pipe from passive to eligible state. + pipes.swap (pipes.index (pipe_), eligible); + eligible++; + + // If there's no message being sent at the moment, move it to + // the active state. + if (!more) { + pipes.swap (eligible - 1, active); + active++; + } } int zmq::dist_t::send (zmq_msg_t *msg_, int flags_) @@ -97,9 +112,9 @@ int zmq::dist_t::send (zmq_msg_t *msg_, int flags_) // Push the message to active pipes. distribute (msg_, flags_); - // If mutlipart message is fully sent, activate new pipes. - if (more && !msg_more) - clear_new_pipes (); + // If multipart message is fully sent, activate all the eligible pipes. + if (!msg_more) + active = eligible; more = msg_more; @@ -173,24 +188,13 @@ bool zmq::dist_t::has_out () bool zmq::dist_t::write (class writer_t *pipe_, zmq_msg_t *msg_) { if (!pipe_->write (msg_)) { + pipes.swap (pipes.index (pipe_), active - 1); active--; - pipes.swap (pipes.index (pipe_), active); + pipes.swap (active, eligible - 1); + eligible--; return false; } if (!(msg_->flags & ZMQ_MSG_MORE)) pipe_->flush (); return true; } - -void zmq::dist_t::clear_new_pipes () -{ - for (new_pipes_t::iterator it = new_pipes.begin (); it != new_pipes.end (); - ++it) { - (*it)->set_event_sink (this); - pipes.push_back (*it); - pipes.swap (active, pipes.size () - 1); - active++; - } - new_pipes.clear (); -} - diff --git a/src/dist.hpp b/src/dist.hpp index ad9767a..45aaf90 100644 --- a/src/dist.hpp +++ b/src/dist.hpp @@ -56,24 +56,22 @@ namespace zmq // Put the message to all active pipes. void distribute (zmq_msg_t *msg_, int flags_); - // Plug in all the delayed pipes. - void clear_new_pipes (); - // List of outbound pipes. typedef array_t pipes_t; pipes_t pipes; - // List of new pipes that were not yet inserted into 'pipes' list. - // These pipes are moves to 'pipes' list once the current multipart - // message is fully sent. This way we avoid sending incomplete messages - // to peers. - typedef std::vector new_pipes_t; - new_pipes_t new_pipes; - // Number of active pipes. All the active pipes are located at the - // beginning of the pipes array. + // beginning of the pipes array. These are the pipes the messages + // can be sent to at the moment. pipes_t::size_type active; + // Number of pipes eligible for sending messages to. This includes all + // the active pipes plus all the pipes that we can in theory send + // messages to (the HWM is not yet reached), but sending a message + // to them would result in partial message being delivered, ie. message + // with initial parts missing. + pipes_t::size_type eligible; + // True if last we are in the middle of a multipart message. bool more; diff --git a/src/err.cpp b/src/err.cpp index 8761c22..d280487 100644 --- a/src/err.cpp +++ b/src/err.cpp @@ -68,119 +68,125 @@ const char *zmq::errno_to_string (int errno_) const char *zmq::wsa_error() { - int errcode = WSAGetLastError (); + int no = WSAGetLastError (); // TODO: This is not a generic way to handle this... - if (errcode == WSAEWOULDBLOCK) + if (no == WSAEWOULDBLOCK) return NULL; + return wsa_error_no (no); +} + +const char *zmq::wsa_error_no (int no_) +{ // TODO: It seems that list of Windows socket errors is longer than this. // Investigate whether there's a way to convert it into the string // automatically (wsaError->HRESULT->string?). return - (errcode == WSABASEERR) ? + (no_ == WSABASEERR) ? "No Error" : - (errcode == WSAEINTR) ? + (no_ == WSAEINTR) ? "Interrupted system call" : - (errcode == WSAEBADF) ? + (no_ == WSAEBADF) ? "Bad file number" : - (errcode == WSAEACCES) ? + (no_ == WSAEACCES) ? "Permission denied" : - (errcode == WSAEFAULT) ? + (no_ == WSAEFAULT) ? "Bad address" : - (errcode == WSAEINVAL) ? + (no_ == WSAEINVAL) ? "Invalid argument" : - (errcode == WSAEMFILE) ? + (no_ == WSAEMFILE) ? "Too many open files" : - (errcode == WSAEWOULDBLOCK) ? + (no_ == WSAEWOULDBLOCK) ? "Operation would block" : - (errcode == WSAEINPROGRESS) ? + (no_ == WSAEINPROGRESS) ? "Operation now in progress" : - (errcode == WSAEALREADY) ? + (no_ == WSAEALREADY) ? "Operation already in progress" : - (errcode == WSAENOTSOCK) ? + (no_ == WSAENOTSOCK) ? "Socket operation on non-socket" : - (errcode == WSAEDESTADDRREQ) ? + (no_ == WSAEDESTADDRREQ) ? "Destination address required" : - (errcode == WSAEMSGSIZE) ? + (no_ == WSAEMSGSIZE) ? "Message too long" : - (errcode == WSAEPROTOTYPE) ? + (no_ == WSAEPROTOTYPE) ? "Protocol wrong type for socket" : - (errcode == WSAENOPROTOOPT) ? + (no_ == WSAENOPROTOOPT) ? "Bad protocol option" : - (errcode == WSAEPROTONOSUPPORT) ? + (no_ == WSAEPROTONOSUPPORT) ? "Protocol not supported" : - (errcode == WSAESOCKTNOSUPPORT) ? + (no_ == WSAESOCKTNOSUPPORT) ? "Socket type not supported" : - (errcode == WSAEOPNOTSUPP) ? + (no_ == WSAEOPNOTSUPP) ? "Operation not supported on socket" : - (errcode == WSAEPFNOSUPPORT) ? + (no_ == WSAEPFNOSUPPORT) ? "Protocol family not supported" : - (errcode == WSAEAFNOSUPPORT) ? + (no_ == WSAEAFNOSUPPORT) ? "Address family not supported by protocol family" : - (errcode == WSAEADDRINUSE) ? + (no_ == WSAEADDRINUSE) ? "Address already in use" : - (errcode == WSAEADDRNOTAVAIL) ? + (no_ == WSAEADDRNOTAVAIL) ? "Can't assign requested address" : - (errcode == WSAENETDOWN) ? + (no_ == WSAENETDOWN) ? "Network is down" : - (errcode == WSAENETUNREACH) ? + (no_ == WSAENETUNREACH) ? "Network is unreachable" : - (errcode == WSAENETRESET) ? + (no_ == WSAENETRESET) ? "Net dropped connection or reset" : - (errcode == WSAECONNABORTED) ? + (no_ == WSAECONNABORTED) ? "Software caused connection abort" : - (errcode == WSAECONNRESET) ? + (no_ == WSAECONNRESET) ? "Connection reset by peer" : - (errcode == WSAENOBUFS) ? + (no_ == WSAENOBUFS) ? "No buffer space available" : - (errcode == WSAEISCONN) ? + (no_ == WSAEISCONN) ? "Socket is already connected" : - (errcode == WSAENOTCONN) ? + (no_ == WSAENOTCONN) ? "Socket is not connected" : - (errcode == WSAESHUTDOWN) ? + (no_ == WSAESHUTDOWN) ? "Can't send after socket shutdown" : - (errcode == WSAETOOMANYREFS) ? + (no_ == WSAETOOMANYREFS) ? "Too many references can't splice" : - (errcode == WSAETIMEDOUT) ? + (no_ == WSAETIMEDOUT) ? "Connection timed out" : - (errcode == WSAECONNREFUSED) ? + (no_ == WSAECONNREFUSED) ? "Connection refused" : - (errcode == WSAELOOP) ? + (no_ == WSAELOOP) ? "Too many levels of symbolic links" : - (errcode == WSAENAMETOOLONG) ? + (no_ == WSAENAMETOOLONG) ? "File name too long" : - (errcode == WSAEHOSTDOWN) ? + (no_ == WSAEHOSTDOWN) ? "Host is down" : - (errcode == WSAEHOSTUNREACH) ? + (no_ == WSAEHOSTUNREACH) ? "No Route to Host" : - (errcode == WSAENOTEMPTY) ? + (no_ == WSAENOTEMPTY) ? "Directory not empty" : - (errcode == WSAEPROCLIM) ? + (no_ == WSAEPROCLIM) ? "Too many processes" : - (errcode == WSAEUSERS) ? + (no_ == WSAEUSERS) ? "Too many users" : - (errcode == WSAEDQUOT) ? + (no_ == WSAEDQUOT) ? "Disc Quota Exceeded" : - (errcode == WSAESTALE) ? + (no_ == WSAESTALE) ? "Stale NFS file handle" : - (errcode == WSAEREMOTE) ? + (no_ == WSAEREMOTE) ? "Too many levels of remote in path" : - (errcode == WSASYSNOTREADY) ? + (no_ == WSASYSNOTREADY) ? "Network SubSystem is unavailable" : - (errcode == WSAVERNOTSUPPORTED) ? + (no_ == WSAVERNOTSUPPORTED) ? "WINSOCK DLL Version out of range" : - (errcode == WSANOTINITIALISED) ? + (no_ == WSANOTINITIALISED) ? "Successful WSASTARTUP not yet performed" : - (errcode == WSAHOST_NOT_FOUND) ? + (no_ == WSAHOST_NOT_FOUND) ? "Host not found" : - (errcode == WSATRY_AGAIN) ? + (no_ == WSATRY_AGAIN) ? "Non-Authoritative Host not found" : - (errcode == WSANO_RECOVERY) ? + (no_ == WSANO_RECOVERY) ? "Non-Recoverable errors: FORMERR REFUSED NOTIMP" : - (errcode == WSANO_DATA) ? + (no_ == WSANO_DATA) ? "Valid name no data record of requested" : "error not defined"; } + void zmq::win_error (char *buffer_, size_t buffer_size_) { DWORD errcode = GetLastError (); diff --git a/src/err.hpp b/src/err.hpp index 3ffd99d..b540a5d 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -46,6 +46,7 @@ namespace zmq namespace zmq { const char *wsa_error (); + const char *wsa_error_no (int no_); void win_error (char *buffer_, size_t buffer_size_); void wsa_error_to_errno (); } @@ -63,6 +64,17 @@ namespace zmq }\ } while (false) +// Provides convenient way to assert on WSA-style errors on Windows. +#define wsa_assert_no(no) \ + do {\ + const char *errstr = zmq::wsa_error_no (no);\ + if (errstr != NULL) {\ + fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ + __FILE__, __LINE__);\ + abort ();\ + }\ + } while (false) + // Provides convenient way to check GetLastError-style errors on Windows. #define win_assert(x) \ do {\ diff --git a/src/rep.cpp b/src/rep.cpp index 46c35cb..dc55ad0 100644 --- a/src/rep.cpp +++ b/src/rep.cpp @@ -78,14 +78,21 @@ int zmq::rep_t::xrecv (zmq_msg_t *msg_, int flags_) int rc = xrep_t::xrecv (msg_, flags_); if (rc != 0) return rc; - zmq_assert (msg_->flags & ZMQ_MSG_MORE); - // Empty message part delimits the traceback stack. - bottom = (zmq_msg_size (msg_) == 0); - - // Push it to the reply pipe. - rc = xrep_t::xsend (msg_, flags_); - zmq_assert (rc == 0); + if ((msg_->flags & ZMQ_MSG_MORE)) { + // Empty message part delimits the traceback stack. + bottom = (zmq_msg_size (msg_) == 0); + + // Push it to the reply pipe. + rc = xrep_t::xsend (msg_, flags_); + zmq_assert (rc == 0); + } + else { + // If the traceback stack is malformed, discard anything + // already sent to pipe (we're at end of invalid message). + rc = xrep_t::rollback (); + zmq_assert (rc == 0); + } } request_begins = false; diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 4317bb0..24789b8 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -61,6 +61,11 @@ #include "xpub.hpp" #include "xsub.hpp" +bool zmq::socket_base_t::check_tag () +{ + return tag == 0xbaddecaf; +} + zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, uint32_t tid_) { @@ -110,6 +115,7 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_) : own_t (parent_, tid_), + tag (0xbaddecaf), ctx_terminated (false), destroyed (false), last_tsc (0), @@ -126,6 +132,9 @@ zmq::socket_base_t::~socket_base_t () sessions_sync.lock (); zmq_assert (sessions.empty ()); sessions_sync.unlock (); + + // Mark the socket as dead. + tag = 0xdeadbeef; } zmq::mailbox_t *zmq::socket_base_t::get_mailbox () diff --git a/src/socket_base.hpp b/src/socket_base.hpp index 15ac83c..333cddd 100644 --- a/src/socket_base.hpp +++ b/src/socket_base.hpp @@ -50,6 +50,9 @@ namespace zmq public: + // Returns false if object is not a socket. + bool check_tag (); + // Create a socket of a specified type. static socket_base_t *create (int type_, class ctx_t *parent_, uint32_t tid_); @@ -136,6 +139,9 @@ namespace zmq private: + // Used to check whether the object is a socket. + uint32_t tag; + // If true, associated context was already terminated. bool ctx_terminated; diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 0c1581d..71b362b 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -118,11 +118,12 @@ zmq::fd_t zmq::tcp_connecter_t::connect () // Assert that the error was caused by the networking problems // rather than 0MQ bug. - errno = err; - errno_assert (errno == WSAECONNREFUSED || errno == WSAETIMEDOUT || - errno == WSAECONNABORTED || errno == WSAEHOSTUNREACH); + if (err == WSAECONNREFUSED || err == WSAETIMEDOUT || + err == WSAECONNABORTED || err == WSAEHOSTUNREACH || + err == WSAENETUNREACH || err == WSAENETDOWN) + return retired_fd; - return retired_fd; + wsa_assert_no (err); } // Return the newly connected socket. diff --git a/src/xrep.cpp b/src/xrep.cpp index 75dc30e..7317056 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -63,7 +63,7 @@ void zmq::xrep_t::xattach_pipes (reader_t *inpipe_, writer_t *outpipe_, if (terminating) { register_term_acks (1); - outpipe_->terminate (); + outpipe_->terminate (); } } @@ -102,11 +102,13 @@ void zmq::xrep_t::terminated (reader_t *pipe_) for (inpipes_t::iterator it = inpipes.begin (); it != inpipes.end (); ++it) { if (it->reader == pipe_) { + if ((inpipes_t::size_type) (it - inpipes.begin ()) < current_in) + current_in--; inpipes.erase (it); - if (terminating) - unregister_term_ack (); if (current_in >= inpipes.size ()) current_in = 0; + if (terminating) + unregister_term_ack (); return; } } @@ -288,6 +290,16 @@ int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_) return -1; } +int zmq::xrep_t::rollback (void) +{ + if (current_out) { + current_out->rollback (); + current_out = NULL; + more_out = false; + } + return 0; +} + bool zmq::xrep_t::xhas_in () { // There are subsequent parts of the partly-read message available. diff --git a/src/xrep.hpp b/src/xrep.hpp index d7fbe9f..d1189f4 100644 --- a/src/xrep.hpp +++ b/src/xrep.hpp @@ -47,6 +47,7 @@ namespace zmq const blob_t &peer_identity_); int xsend (zmq_msg_t *msg_, int flags_); int xrecv (zmq_msg_t *msg_, int flags_); + int rollback (); bool xhas_in (); bool xhas_out (); diff --git a/src/zmq.cpp b/src/zmq.cpp index 61f942d..85f7d62 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -284,7 +284,7 @@ void *zmq_init (int io_threads_) int zmq_term (void *ctx_) { - if (!ctx_) { + if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) { errno = EFAULT; return -1; } @@ -310,7 +310,7 @@ int zmq_term (void *ctx_) void *zmq_socket (void *ctx_, int type_) { - if (!ctx_) { + if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) { errno = EFAULT; return NULL; } @@ -319,8 +319,8 @@ void *zmq_socket (void *ctx_, int type_) int zmq_close (void *s_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } ((zmq::socket_base_t*) s_)->close (); @@ -330,8 +330,8 @@ int zmq_close (void *s_) int zmq_setsockopt (void *s_, int option_, const void *optval_, size_t optvallen_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->setsockopt (option_, optval_, @@ -340,8 +340,8 @@ int zmq_setsockopt (void *s_, int option_, const void *optval_, int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->getsockopt (option_, optval_, @@ -350,8 +350,8 @@ int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_) int zmq_bind (void *s_, const char *addr_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->bind (addr_)); @@ -359,8 +359,8 @@ int zmq_bind (void *s_, const char *addr_) int zmq_connect (void *s_, const char *addr_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->connect (addr_)); @@ -368,8 +368,8 @@ int zmq_connect (void *s_, const char *addr_) int zmq_send (void *s_, zmq_msg_t *msg_, int flags_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->send (msg_, flags_)); @@ -377,8 +377,8 @@ int zmq_send (void *s_, zmq_msg_t *msg_, int flags_) int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_) { - if (!s_) { - errno = EFAULT; + if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { + errno = ENOTSOCK; return -1; } return (((zmq::socket_base_t*) s_)->recv (msg_, flags_)); diff --git a/zeromq.spec b/zeromq.spec index dbef594..4d6a634 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.1.6 +Version: 2.1.7 Release: 1%{?dist} Summary: The ZeroMQ messaging library Group: Applications/Internet -- cgit v1.2.3