libzmq 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +703 -0
- data/README.md +31 -0
- data/lib/libzmq.rb +17 -0
- data/lib/libzmq/ffi-rzmq.rb +3 -0
- data/libzmq/Makefile +5 -0
- data/libzmq/extconf.rb +24 -0
- data/libzmq/zeromq-2.1.7/AUTHORS +92 -0
- data/libzmq/zeromq-2.1.7/COPYING +674 -0
- data/libzmq/zeromq-2.1.7/COPYING.LESSER +206 -0
- data/libzmq/zeromq-2.1.7/ChangeLog +15620 -0
- data/libzmq/zeromq-2.1.7/INSTALL +237 -0
- data/libzmq/zeromq-2.1.7/MAINTAINERS +56 -0
- data/libzmq/zeromq-2.1.7/Makefile.am +42 -0
- data/libzmq/zeromq-2.1.7/Makefile.in +779 -0
- data/libzmq/zeromq-2.1.7/NEWS +275 -0
- data/libzmq/zeromq-2.1.7/README +39 -0
- data/libzmq/zeromq-2.1.7/acinclude.m4 +582 -0
- data/libzmq/zeromq-2.1.7/aclocal.m4 +1206 -0
- data/libzmq/zeromq-2.1.7/autogen.sh +45 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/Makefile.am +8 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/Makefile.in +390 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/c_local_lat/c_local_lat.vcproj +176 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/c_local_thr/c_local_thr.vcproj +176 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/c_remote_lat/c_remote_lat.vcproj +176 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/c_remote_thr/c_remote_thr.vcproj +176 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/libzmq/libzmq.vcproj +783 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/msvc.sln +89 -0
- data/libzmq/zeromq-2.1.7/builds/msvc/platform.hpp +32 -0
- data/libzmq/zeromq-2.1.7/builds/redhat/zeromq.spec.in +139 -0
- data/libzmq/zeromq-2.1.7/config/compile +143 -0
- data/libzmq/zeromq-2.1.7/config/config.guess +1502 -0
- data/libzmq/zeromq-2.1.7/config/config.sub +1714 -0
- data/libzmq/zeromq-2.1.7/config/depcomp +630 -0
- data/libzmq/zeromq-2.1.7/config/install-sh +520 -0
- data/libzmq/zeromq-2.1.7/config/libtool.m4 +7377 -0
- data/libzmq/zeromq-2.1.7/config/ltmain.sh +8413 -0
- data/libzmq/zeromq-2.1.7/config/ltoptions.m4 +368 -0
- data/libzmq/zeromq-2.1.7/config/ltsugar.m4 +123 -0
- data/libzmq/zeromq-2.1.7/config/ltversion.m4 +23 -0
- data/libzmq/zeromq-2.1.7/config/lt~obsolete.m4 +92 -0
- data/libzmq/zeromq-2.1.7/config/missing +376 -0
- data/libzmq/zeromq-2.1.7/configure +21645 -0
- data/libzmq/zeromq-2.1.7/configure.in +380 -0
- data/libzmq/zeromq-2.1.7/doc/Makefile.am +46 -0
- data/libzmq/zeromq-2.1.7/doc/Makefile.in +546 -0
- data/libzmq/zeromq-2.1.7/doc/asciidoc.conf +56 -0
- data/libzmq/zeromq-2.1.7/doc/zmq.7 +242 -0
- data/libzmq/zeromq-2.1.7/doc/zmq.html +846 -0
- data/libzmq/zeromq-2.1.7/doc/zmq.txt +218 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_bind.3 +166 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_bind.html +746 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_bind.txt +91 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_close.3 +81 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_close.html +645 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_close.txt +52 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_connect.3 +161 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_connect.html +732 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_connect.txt +89 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_cpp.7 +410 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_cpp.html +765 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_cpp.txt +212 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_device.3 +140 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_device.html +736 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_device.txt +138 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_epgm.7 +209 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_epgm.html +749 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_epgm.txt +162 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_errno.3 +78 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_errno.html +634 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_errno.txt +50 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_getsockopt.3 +944 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_getsockopt.html +1713 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_getsockopt.txt +407 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_init.3 +71 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_init.html +635 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_init.txt +51 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_inproc.7 +115 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_inproc.html +669 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_inproc.txt +89 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_ipc.7 +109 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_ipc.html +662 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_ipc.txt +80 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_close.3 +81 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_close.html +647 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_close.txt +55 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_copy.3 +95 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_copy.html +656 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_copy.txt +57 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_data.3 +76 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_data.html +633 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_data.txt +48 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init.3 +110 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init.html +656 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init.txt +65 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_data.3 +138 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_data.html +678 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_data.txt +83 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_size.3 +97 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_size.html +656 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_init_size.txt +58 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_move.3 +79 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_move.html +645 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_move.txt +52 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_size.3 +76 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_size.html +633 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_msg_size.txt +48 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_pgm.7 +209 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_pgm.html +749 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_pgm.txt +162 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_poll.3 +204 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_poll.html +755 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_poll.txt +132 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_recv.3 +172 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_recv.html +746 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_recv.txt +121 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_send.3 +185 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_send.html +755 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_send.txt +120 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_setsockopt.3 +878 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_setsockopt.html +1603 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_setsockopt.txt +382 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_socket.3 +779 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_socket.html +1424 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_socket.txt +342 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_strerror.3 +78 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_strerror.html +634 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_strerror.txt +55 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_tcp.7 +244 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_tcp.html +755 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_tcp.txt +162 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_term.3 +135 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_term.html +672 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_term.txt +65 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_version.3 +78 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_version.html +632 -0
- data/libzmq/zeromq-2.1.7/doc/zmq_version.txt +53 -0
- data/libzmq/zeromq-2.1.7/foreign/openpgm/Makefile.am +8 -0
- data/libzmq/zeromq-2.1.7/foreign/openpgm/Makefile.in +588 -0
- data/libzmq/zeromq-2.1.7/foreign/openpgm/libpgm-5.1.115~dfsg.tar.gz +0 -0
- data/libzmq/zeromq-2.1.7/foreign/xmlParser/xmlParser.cpp +2923 -0
- data/libzmq/zeromq-2.1.7/foreign/xmlParser/xmlParser.hpp +762 -0
- data/libzmq/zeromq-2.1.7/include/zmq.h +269 -0
- data/libzmq/zeromq-2.1.7/include/zmq.hpp +301 -0
- data/libzmq/zeromq-2.1.7/include/zmq_utils.h +64 -0
- data/libzmq/zeromq-2.1.7/perf/Makefile.am +21 -0
- data/libzmq/zeromq-2.1.7/perf/Makefile.in +566 -0
- data/libzmq/zeromq-2.1.7/perf/inproc_lat.cpp +232 -0
- data/libzmq/zeromq-2.1.7/perf/inproc_thr.cpp +246 -0
- data/libzmq/zeromq-2.1.7/perf/local_lat.cpp +108 -0
- data/libzmq/zeromq-2.1.7/perf/local_thr.cpp +138 -0
- data/libzmq/zeromq-2.1.7/perf/remote_lat.cpp +121 -0
- data/libzmq/zeromq-2.1.7/perf/remote_thr.cpp +104 -0
- data/libzmq/zeromq-2.1.7/src/Makefile.am +155 -0
- data/libzmq/zeromq-2.1.7/src/Makefile.in +1320 -0
- data/libzmq/zeromq-2.1.7/src/array.hpp +147 -0
- data/libzmq/zeromq-2.1.7/src/atomic_counter.hpp +164 -0
- data/libzmq/zeromq-2.1.7/src/atomic_ptr.hpp +159 -0
- data/libzmq/zeromq-2.1.7/src/blob.hpp +34 -0
- data/libzmq/zeromq-2.1.7/src/clock.cpp +118 -0
- data/libzmq/zeromq-2.1.7/src/clock.hpp +60 -0
- data/libzmq/zeromq-2.1.7/src/command.cpp +39 -0
- data/libzmq/zeromq-2.1.7/src/command.hpp +147 -0
- data/libzmq/zeromq-2.1.7/src/config.hpp +88 -0
- data/libzmq/zeromq-2.1.7/src/connect_session.cpp +119 -0
- data/libzmq/zeromq-2.1.7/src/connect_session.hpp +65 -0
- data/libzmq/zeromq-2.1.7/src/ctx.cpp +322 -0
- data/libzmq/zeromq-2.1.7/src/ctx.hpp +159 -0
- data/libzmq/zeromq-2.1.7/src/decoder.cpp +129 -0
- data/libzmq/zeromq-2.1.7/src/decoder.hpp +207 -0
- data/libzmq/zeromq-2.1.7/src/device.cpp +120 -0
- data/libzmq/zeromq-2.1.7/src/device.hpp +32 -0
- data/libzmq/zeromq-2.1.7/src/devpoll.cpp +190 -0
- data/libzmq/zeromq-2.1.7/src/devpoll.hpp +100 -0
- data/libzmq/zeromq-2.1.7/src/dist.cpp +200 -0
- data/libzmq/zeromq-2.1.7/src/dist.hpp +90 -0
- data/libzmq/zeromq-2.1.7/src/encoder.cpp +90 -0
- data/libzmq/zeromq-2.1.7/src/encoder.hpp +184 -0
- data/libzmq/zeromq-2.1.7/src/epoll.cpp +177 -0
- data/libzmq/zeromq-2.1.7/src/epoll.hpp +96 -0
- data/libzmq/zeromq-2.1.7/src/err.cpp +238 -0
- data/libzmq/zeromq-2.1.7/src/err.hpp +145 -0
- data/libzmq/zeromq-2.1.7/src/fd.hpp +45 -0
- data/libzmq/zeromq-2.1.7/src/fq.cpp +164 -0
- data/libzmq/zeromq-2.1.7/src/fq.hpp +80 -0
- data/libzmq/zeromq-2.1.7/src/i_engine.hpp +53 -0
- data/libzmq/zeromq-2.1.7/src/i_inout.hpp +50 -0
- data/libzmq/zeromq-2.1.7/src/i_poll_events.hpp +46 -0
- data/libzmq/zeromq-2.1.7/src/io_object.cpp +107 -0
- data/libzmq/zeromq-2.1.7/src/io_object.hpp +78 -0
- data/libzmq/zeromq-2.1.7/src/io_thread.cpp +109 -0
- data/libzmq/zeromq-2.1.7/src/io_thread.hpp +88 -0
- data/libzmq/zeromq-2.1.7/src/ip.cpp +339 -0
- data/libzmq/zeromq-2.1.7/src/ip.hpp +68 -0
- data/libzmq/zeromq-2.1.7/src/kqueue.cpp +194 -0
- data/libzmq/zeromq-2.1.7/src/kqueue.hpp +103 -0
- data/libzmq/zeromq-2.1.7/src/lb.cpp +174 -0
- data/libzmq/zeromq-2.1.7/src/lb.hpp +79 -0
- data/libzmq/zeromq-2.1.7/src/libzmq.pc.in +10 -0
- data/libzmq/zeromq-2.1.7/src/likely.hpp +33 -0
- data/libzmq/zeromq-2.1.7/src/mailbox.cpp +382 -0
- data/libzmq/zeromq-2.1.7/src/mailbox.hpp +62 -0
- data/libzmq/zeromq-2.1.7/src/msg_content.hpp +52 -0
- data/libzmq/zeromq-2.1.7/src/mutex.hpp +121 -0
- data/libzmq/zeromq-2.1.7/src/named_session.cpp +85 -0
- data/libzmq/zeromq-2.1.7/src/named_session.hpp +57 -0
- data/libzmq/zeromq-2.1.7/src/object.cpp +467 -0
- data/libzmq/zeromq-2.1.7/src/object.hpp +127 -0
- data/libzmq/zeromq-2.1.7/src/options.cpp +336 -0
- data/libzmq/zeromq-2.1.7/src/options.hpp +87 -0
- data/libzmq/zeromq-2.1.7/src/own.cpp +214 -0
- data/libzmq/zeromq-2.1.7/src/own.hpp +140 -0
- data/libzmq/zeromq-2.1.7/src/pair.cpp +180 -0
- data/libzmq/zeromq-2.1.7/src/pair.hpp +76 -0
- data/libzmq/zeromq-2.1.7/src/pgm_receiver.cpp +259 -0
- data/libzmq/zeromq-2.1.7/src/pgm_receiver.hpp +129 -0
- data/libzmq/zeromq-2.1.7/src/pgm_sender.cpp +215 -0
- data/libzmq/zeromq-2.1.7/src/pgm_sender.hpp +105 -0
- data/libzmq/zeromq-2.1.7/src/pgm_socket.cpp +705 -0
- data/libzmq/zeromq-2.1.7/src/pgm_socket.hpp +118 -0
- data/libzmq/zeromq-2.1.7/src/pipe.cpp +409 -0
- data/libzmq/zeromq-2.1.7/src/pipe.hpp +214 -0
- data/libzmq/zeromq-2.1.7/src/platform.hpp.in +228 -0
- data/libzmq/zeromq-2.1.7/src/poll.cpp +180 -0
- data/libzmq/zeromq-2.1.7/src/poll.hpp +104 -0
- data/libzmq/zeromq-2.1.7/src/poller.hpp +73 -0
- data/libzmq/zeromq-2.1.7/src/poller_base.cpp +99 -0
- data/libzmq/zeromq-2.1.7/src/poller_base.hpp +84 -0
- data/libzmq/zeromq-2.1.7/src/pub.cpp +31 -0
- data/libzmq/zeromq-2.1.7/src/pub.hpp +44 -0
- data/libzmq/zeromq-2.1.7/src/pull.cpp +61 -0
- data/libzmq/zeromq-2.1.7/src/pull.hpp +60 -0
- data/libzmq/zeromq-2.1.7/src/push.cpp +62 -0
- data/libzmq/zeromq-2.1.7/src/push.hpp +59 -0
- data/libzmq/zeromq-2.1.7/src/reaper.cpp +121 -0
- data/libzmq/zeromq-2.1.7/src/reaper.hpp +77 -0
- data/libzmq/zeromq-2.1.7/src/rep.cpp +131 -0
- data/libzmq/zeromq-2.1.7/src/rep.hpp +59 -0
- data/libzmq/zeromq-2.1.7/src/req.cpp +121 -0
- data/libzmq/zeromq-2.1.7/src/req.hpp +58 -0
- data/libzmq/zeromq-2.1.7/src/select.cpp +211 -0
- data/libzmq/zeromq-2.1.7/src/select.hpp +116 -0
- data/libzmq/zeromq-2.1.7/src/semaphore.hpp +189 -0
- data/libzmq/zeromq-2.1.7/src/session.cpp +347 -0
- data/libzmq/zeromq-2.1.7/src/session.hpp +150 -0
- data/libzmq/zeromq-2.1.7/src/socket_base.cpp +811 -0
- data/libzmq/zeromq-2.1.7/src/socket_base.hpp +207 -0
- data/libzmq/zeromq-2.1.7/src/stdint.hpp +63 -0
- data/libzmq/zeromq-2.1.7/src/sub.cpp +75 -0
- data/libzmq/zeromq-2.1.7/src/sub.hpp +50 -0
- data/libzmq/zeromq-2.1.7/src/swap.cpp +325 -0
- data/libzmq/zeromq-2.1.7/src/swap.hpp +123 -0
- data/libzmq/zeromq-2.1.7/src/tcp_connecter.cpp +310 -0
- data/libzmq/zeromq-2.1.7/src/tcp_connecter.hpp +81 -0
- data/libzmq/zeromq-2.1.7/src/tcp_listener.cpp +371 -0
- data/libzmq/zeromq-2.1.7/src/tcp_listener.hpp +73 -0
- data/libzmq/zeromq-2.1.7/src/tcp_socket.cpp +228 -0
- data/libzmq/zeromq-2.1.7/src/tcp_socket.hpp +72 -0
- data/libzmq/zeromq-2.1.7/src/thread.cpp +97 -0
- data/libzmq/zeromq-2.1.7/src/thread.hpp +78 -0
- data/libzmq/zeromq-2.1.7/src/transient_session.cpp +41 -0
- data/libzmq/zeromq-2.1.7/src/transient_session.hpp +52 -0
- data/libzmq/zeromq-2.1.7/src/trie.cpp +181 -0
- data/libzmq/zeromq-2.1.7/src/trie.hpp +59 -0
- data/libzmq/zeromq-2.1.7/src/uuid.cpp +233 -0
- data/libzmq/zeromq-2.1.7/src/uuid.hpp +111 -0
- data/libzmq/zeromq-2.1.7/src/windows.hpp +79 -0
- data/libzmq/zeromq-2.1.7/src/wire.hpp +99 -0
- data/libzmq/zeromq-2.1.7/src/xpub.cpp +76 -0
- data/libzmq/zeromq-2.1.7/src/xpub.hpp +61 -0
- data/libzmq/zeromq-2.1.7/src/xrep.cpp +337 -0
- data/libzmq/zeromq-2.1.7/src/xrep.hpp +116 -0
- data/libzmq/zeromq-2.1.7/src/xreq.cpp +74 -0
- data/libzmq/zeromq-2.1.7/src/xreq.hpp +65 -0
- data/libzmq/zeromq-2.1.7/src/xsub.cpp +172 -0
- data/libzmq/zeromq-2.1.7/src/xsub.hpp +80 -0
- data/libzmq/zeromq-2.1.7/src/ypipe.hpp +209 -0
- data/libzmq/zeromq-2.1.7/src/yqueue.hpp +198 -0
- data/libzmq/zeromq-2.1.7/src/zmq.cpp +798 -0
- data/libzmq/zeromq-2.1.7/src/zmq_connecter.cpp +166 -0
- data/libzmq/zeromq-2.1.7/src/zmq_connecter.hpp +92 -0
- data/libzmq/zeromq-2.1.7/src/zmq_engine.cpp +220 -0
- data/libzmq/zeromq-2.1.7/src/zmq_engine.hpp +87 -0
- data/libzmq/zeromq-2.1.7/src/zmq_init.cpp +216 -0
- data/libzmq/zeromq-2.1.7/src/zmq_init.hpp +93 -0
- data/libzmq/zeromq-2.1.7/src/zmq_listener.cpp +78 -0
- data/libzmq/zeromq-2.1.7/src/zmq_listener.hpp +67 -0
- data/libzmq/zeromq-2.1.7/tests/Makefile.am +30 -0
- data/libzmq/zeromq-2.1.7/tests/Makefile.in +713 -0
- data/libzmq/zeromq-2.1.7/tests/test_hwm.cpp +68 -0
- data/libzmq/zeromq-2.1.7/tests/test_pair_inproc.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_pair_ipc.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_pair_tcp.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_reqrep_inproc.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_reqrep_ipc.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_reqrep_tcp.cpp +31 -0
- data/libzmq/zeromq-2.1.7/tests/test_shutdown_stress.cpp +87 -0
- data/libzmq/zeromq-2.1.7/tests/testutil.hpp +130 -0
- data/libzmq/zeromq-2.1.7/version.sh +21 -0
- data/libzmq/zeromq-2.1.7/zeromq.spec +139 -0
- metadata +348 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2007-2011 iMatix Corporation
|
3
|
+
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
|
4
|
+
|
5
|
+
This file is part of 0MQ.
|
6
|
+
|
7
|
+
0MQ is free software; you can redistribute it and/or modify it under
|
8
|
+
the terms of the GNU Lesser General Public License as published by
|
9
|
+
the Free Software Foundation; either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
0MQ is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU Lesser General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Lesser General Public License
|
18
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef __ZMQ_SELECT_HPP_INCLUDED__
|
22
|
+
#define __ZMQ_SELECT_HPP_INCLUDED__
|
23
|
+
|
24
|
+
#include "platform.hpp"
|
25
|
+
|
26
|
+
#include <stddef.h>
|
27
|
+
#include <vector>
|
28
|
+
|
29
|
+
#ifdef ZMQ_HAVE_WINDOWS
|
30
|
+
#include "winsock2.h"
|
31
|
+
#elif defined ZMQ_HAVE_OPENVMS
|
32
|
+
#include <sys/types.h>
|
33
|
+
#include <sys/time.h>
|
34
|
+
#else
|
35
|
+
#include <sys/select.h>
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#include "fd.hpp"
|
39
|
+
#include "thread.hpp"
|
40
|
+
#include "poller_base.hpp"
|
41
|
+
|
42
|
+
namespace zmq
|
43
|
+
{
|
44
|
+
|
45
|
+
// Implements socket polling mechanism using POSIX.1-2001 select()
|
46
|
+
// function.
|
47
|
+
|
48
|
+
class select_t : public poller_base_t
|
49
|
+
{
|
50
|
+
public:
|
51
|
+
|
52
|
+
typedef fd_t handle_t;
|
53
|
+
|
54
|
+
select_t ();
|
55
|
+
~select_t ();
|
56
|
+
|
57
|
+
// "poller" concept.
|
58
|
+
handle_t add_fd (fd_t fd_, struct i_poll_events *events_);
|
59
|
+
void rm_fd (handle_t handle_);
|
60
|
+
void set_pollin (handle_t handle_);
|
61
|
+
void reset_pollin (handle_t handle_);
|
62
|
+
void set_pollout (handle_t handle_);
|
63
|
+
void reset_pollout (handle_t handle_);
|
64
|
+
void start ();
|
65
|
+
void stop ();
|
66
|
+
|
67
|
+
private:
|
68
|
+
|
69
|
+
// Main worker thread routine.
|
70
|
+
static void worker_routine (void *arg_);
|
71
|
+
|
72
|
+
// Main event loop.
|
73
|
+
void loop ();
|
74
|
+
|
75
|
+
struct fd_entry_t
|
76
|
+
{
|
77
|
+
fd_t fd;
|
78
|
+
struct i_poll_events *events;
|
79
|
+
};
|
80
|
+
|
81
|
+
// Checks if an fd_entry_t is retired.
|
82
|
+
static bool is_retired_fd (const fd_entry_t &entry);
|
83
|
+
|
84
|
+
// Set of file descriptors that are used to retreive
|
85
|
+
// information for fd_set.
|
86
|
+
typedef std::vector <fd_entry_t> fd_set_t;
|
87
|
+
fd_set_t fds;
|
88
|
+
|
89
|
+
fd_set source_set_in;
|
90
|
+
fd_set source_set_out;
|
91
|
+
fd_set source_set_err;
|
92
|
+
|
93
|
+
fd_set readfds;
|
94
|
+
fd_set writefds;
|
95
|
+
fd_set exceptfds;
|
96
|
+
|
97
|
+
// Maximum file descriptor.
|
98
|
+
fd_t maxfd;
|
99
|
+
|
100
|
+
// If true, at least one file descriptor has retired.
|
101
|
+
bool retired;
|
102
|
+
|
103
|
+
// If true, thread is shutting down.
|
104
|
+
bool stopping;
|
105
|
+
|
106
|
+
// Handle of the physical thread doing the I/O work.
|
107
|
+
thread_t worker;
|
108
|
+
|
109
|
+
select_t (const select_t&);
|
110
|
+
const select_t &operator = (const select_t&);
|
111
|
+
};
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
#endif
|
116
|
+
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2007-2011 iMatix Corporation
|
3
|
+
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
|
4
|
+
|
5
|
+
This file is part of 0MQ.
|
6
|
+
|
7
|
+
0MQ is free software; you can redistribute it and/or modify it under
|
8
|
+
the terms of the GNU Lesser General Public License as published by
|
9
|
+
the Free Software Foundation; either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
0MQ is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU Lesser General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Lesser General Public License
|
18
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef __ZMQ_SEMAPHORE_HPP_INCLUDED__
|
22
|
+
#define __ZMQ_SEMAPHORE_HPP_INCLUDED__
|
23
|
+
|
24
|
+
#include "platform.hpp"
|
25
|
+
#include "err.hpp"
|
26
|
+
|
27
|
+
#if defined ZMQ_HAVE_WINDOWS
|
28
|
+
#include "windows.hpp"
|
29
|
+
#elif defined ZMQ_HAVE_OPENVMS
|
30
|
+
#include <pthread.h>
|
31
|
+
#else
|
32
|
+
#include <semaphore.h>
|
33
|
+
#endif
|
34
|
+
|
35
|
+
namespace zmq
|
36
|
+
{
|
37
|
+
// Simple semaphore. Only single thread may be waiting at any given time.
|
38
|
+
// Also, the semaphore may not be posted before the previous post
|
39
|
+
// was matched by corresponding wait and the waiting thread was
|
40
|
+
// released.
|
41
|
+
|
42
|
+
#if defined ZMQ_HAVE_WINDOWS
|
43
|
+
|
44
|
+
// On Windows platform simple semaphore is implemeted using event object.
|
45
|
+
|
46
|
+
class semaphore_t
|
47
|
+
{
|
48
|
+
public:
|
49
|
+
|
50
|
+
// Initialise the semaphore.
|
51
|
+
inline semaphore_t ()
|
52
|
+
{
|
53
|
+
ev = CreateEvent (NULL, FALSE, FALSE, NULL);
|
54
|
+
win_assert (ev != NULL);
|
55
|
+
}
|
56
|
+
|
57
|
+
// Destroy the semaphore.
|
58
|
+
inline ~semaphore_t ()
|
59
|
+
{
|
60
|
+
int rc = CloseHandle (ev);
|
61
|
+
win_assert (rc != 0);
|
62
|
+
}
|
63
|
+
|
64
|
+
// Wait for the semaphore.
|
65
|
+
inline void wait ()
|
66
|
+
{
|
67
|
+
DWORD rc = WaitForSingleObject (ev, INFINITE);
|
68
|
+
win_assert (rc != WAIT_FAILED);
|
69
|
+
}
|
70
|
+
|
71
|
+
// Post the semaphore.
|
72
|
+
inline void post ()
|
73
|
+
{
|
74
|
+
int rc = SetEvent (ev);
|
75
|
+
win_assert (rc != 0);
|
76
|
+
}
|
77
|
+
|
78
|
+
private:
|
79
|
+
|
80
|
+
HANDLE ev;
|
81
|
+
|
82
|
+
semaphore_t (const semaphore_t&);
|
83
|
+
const semaphore_t &operator = (const semaphore_t&);
|
84
|
+
};
|
85
|
+
|
86
|
+
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENVMS
|
87
|
+
|
88
|
+
// On platforms that allow for double locking of a mutex from the same
|
89
|
+
// thread, simple semaphore is implemented using mutex, as it is more
|
90
|
+
// efficient than full-blown semaphore.
|
91
|
+
|
92
|
+
// Note that OS-level semaphore is not implemented on OSX, so the below
|
93
|
+
// code is not only optimisation, it's necessary to make 0MQ work on OSX.
|
94
|
+
|
95
|
+
class semaphore_t
|
96
|
+
{
|
97
|
+
public:
|
98
|
+
|
99
|
+
// Initialise the semaphore.
|
100
|
+
inline semaphore_t ()
|
101
|
+
{
|
102
|
+
int rc = pthread_mutex_init (&mutex, NULL);
|
103
|
+
posix_assert (rc);
|
104
|
+
rc = pthread_mutex_lock (&mutex);
|
105
|
+
posix_assert (rc);
|
106
|
+
}
|
107
|
+
|
108
|
+
// Destroy the semaphore.
|
109
|
+
inline ~semaphore_t ()
|
110
|
+
{
|
111
|
+
int rc = pthread_mutex_unlock (&mutex);
|
112
|
+
posix_assert (rc);
|
113
|
+
rc = pthread_mutex_destroy (&mutex);
|
114
|
+
posix_assert (rc);
|
115
|
+
}
|
116
|
+
|
117
|
+
// Wait for the semaphore.
|
118
|
+
inline void wait ()
|
119
|
+
{
|
120
|
+
int rc = pthread_mutex_lock (&mutex);
|
121
|
+
posix_assert (rc);
|
122
|
+
}
|
123
|
+
|
124
|
+
// Post the semaphore.
|
125
|
+
inline void post ()
|
126
|
+
{
|
127
|
+
int rc = pthread_mutex_unlock (&mutex);
|
128
|
+
posix_assert (rc);
|
129
|
+
}
|
130
|
+
|
131
|
+
private:
|
132
|
+
|
133
|
+
pthread_mutex_t mutex;
|
134
|
+
|
135
|
+
semaphore_t (const semaphore_t&);
|
136
|
+
const semaphore_t &operator = (const semaphore_t&);
|
137
|
+
};
|
138
|
+
|
139
|
+
#else
|
140
|
+
|
141
|
+
// Default implementation maps simple semaphore to POSIX semaphore.
|
142
|
+
|
143
|
+
class semaphore_t
|
144
|
+
{
|
145
|
+
public:
|
146
|
+
|
147
|
+
// Initialise the semaphore.
|
148
|
+
inline semaphore_t ()
|
149
|
+
{
|
150
|
+
int rc = sem_init (&sem, 0, 0);
|
151
|
+
errno_assert (rc != -1);
|
152
|
+
}
|
153
|
+
|
154
|
+
// Destroy the semaphore.
|
155
|
+
inline ~semaphore_t ()
|
156
|
+
{
|
157
|
+
int rc = sem_destroy (&sem);
|
158
|
+
errno_assert (rc != -1);
|
159
|
+
}
|
160
|
+
|
161
|
+
// Wait for the semaphore.
|
162
|
+
inline void wait ()
|
163
|
+
{
|
164
|
+
int rc = sem_wait (&sem);
|
165
|
+
errno_assert (rc != -1);
|
166
|
+
}
|
167
|
+
|
168
|
+
// Post the semaphore.
|
169
|
+
inline void post ()
|
170
|
+
{
|
171
|
+
int rc = sem_post (&sem);
|
172
|
+
errno_assert (rc != -1);
|
173
|
+
}
|
174
|
+
|
175
|
+
private:
|
176
|
+
|
177
|
+
// Underlying system semaphore object.
|
178
|
+
sem_t sem;
|
179
|
+
|
180
|
+
semaphore_t (const semaphore_t&);
|
181
|
+
const semaphore_t &operator = (const semaphore_t&);
|
182
|
+
};
|
183
|
+
|
184
|
+
#endif
|
185
|
+
|
186
|
+
}
|
187
|
+
|
188
|
+
#endif
|
189
|
+
|
@@ -0,0 +1,347 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2007-2011 iMatix Corporation
|
3
|
+
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
|
4
|
+
|
5
|
+
This file is part of 0MQ.
|
6
|
+
|
7
|
+
0MQ is free software; you can redistribute it and/or modify it under
|
8
|
+
the terms of the GNU Lesser General Public License as published by
|
9
|
+
the Free Software Foundation; either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
0MQ is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU Lesser General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Lesser General Public License
|
18
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "session.hpp"
|
22
|
+
#include "socket_base.hpp"
|
23
|
+
#include "i_engine.hpp"
|
24
|
+
#include "err.hpp"
|
25
|
+
#include "pipe.hpp"
|
26
|
+
#include "likely.hpp"
|
27
|
+
|
28
|
+
zmq::session_t::session_t (class io_thread_t *io_thread_,
|
29
|
+
class socket_base_t *socket_, const options_t &options_) :
|
30
|
+
own_t (io_thread_, options_),
|
31
|
+
io_object_t (io_thread_),
|
32
|
+
in_pipe (NULL),
|
33
|
+
incomplete_in (false),
|
34
|
+
out_pipe (NULL),
|
35
|
+
engine (NULL),
|
36
|
+
socket (socket_),
|
37
|
+
io_thread (io_thread_),
|
38
|
+
pipes_attached (false),
|
39
|
+
delimiter_processed (false),
|
40
|
+
force_terminate (false),
|
41
|
+
has_linger_timer (false),
|
42
|
+
state (active)
|
43
|
+
{
|
44
|
+
}
|
45
|
+
|
46
|
+
zmq::session_t::~session_t ()
|
47
|
+
{
|
48
|
+
zmq_assert (!in_pipe);
|
49
|
+
zmq_assert (!out_pipe);
|
50
|
+
|
51
|
+
if (engine)
|
52
|
+
engine->terminate ();
|
53
|
+
}
|
54
|
+
|
55
|
+
void zmq::session_t::proceed_with_term ()
|
56
|
+
{
|
57
|
+
if (state == terminating)
|
58
|
+
return;
|
59
|
+
|
60
|
+
zmq_assert (state == pending);
|
61
|
+
state = terminating;
|
62
|
+
|
63
|
+
// If there's still a pending linger timer, remove it.
|
64
|
+
if (has_linger_timer) {
|
65
|
+
cancel_timer (linger_timer_id);
|
66
|
+
has_linger_timer = false;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (in_pipe) {
|
70
|
+
register_term_acks (1);
|
71
|
+
in_pipe->terminate ();
|
72
|
+
}
|
73
|
+
if (out_pipe) {
|
74
|
+
register_term_acks (1);
|
75
|
+
out_pipe->terminate ();
|
76
|
+
}
|
77
|
+
|
78
|
+
// The session has already waited for the linger period. We don't want
|
79
|
+
// the child objects to linger any more thus linger is set to zero.
|
80
|
+
own_t::process_term (0);
|
81
|
+
}
|
82
|
+
|
83
|
+
bool zmq::session_t::read (::zmq_msg_t *msg_)
|
84
|
+
{
|
85
|
+
if (!in_pipe)
|
86
|
+
return false;
|
87
|
+
|
88
|
+
if (!in_pipe->read (msg_))
|
89
|
+
return false;
|
90
|
+
|
91
|
+
incomplete_in = msg_->flags & ZMQ_MSG_MORE;
|
92
|
+
return true;
|
93
|
+
}
|
94
|
+
|
95
|
+
bool zmq::session_t::write (::zmq_msg_t *msg_)
|
96
|
+
{
|
97
|
+
if (out_pipe && out_pipe->write (msg_)) {
|
98
|
+
zmq_msg_init (msg_);
|
99
|
+
return true;
|
100
|
+
}
|
101
|
+
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
|
105
|
+
void zmq::session_t::flush ()
|
106
|
+
{
|
107
|
+
if (out_pipe)
|
108
|
+
out_pipe->flush ();
|
109
|
+
}
|
110
|
+
|
111
|
+
void zmq::session_t::clean_pipes ()
|
112
|
+
{
|
113
|
+
// Get rid of half-processed messages in the out pipe. Flush any
|
114
|
+
// unflushed messages upstream.
|
115
|
+
if (out_pipe) {
|
116
|
+
out_pipe->rollback ();
|
117
|
+
out_pipe->flush ();
|
118
|
+
}
|
119
|
+
|
120
|
+
// Remove any half-read message from the in pipe.
|
121
|
+
if (in_pipe) {
|
122
|
+
while (incomplete_in) {
|
123
|
+
zmq_msg_t msg;
|
124
|
+
zmq_msg_init (&msg);
|
125
|
+
if (!read (&msg)) {
|
126
|
+
zmq_assert (!incomplete_in);
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
zmq_msg_close (&msg);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
void zmq::session_t::attach_pipes (class reader_t *inpipe_,
|
135
|
+
class writer_t *outpipe_, const blob_t &peer_identity_)
|
136
|
+
{
|
137
|
+
zmq_assert (!pipes_attached);
|
138
|
+
pipes_attached = true;
|
139
|
+
|
140
|
+
if (inpipe_) {
|
141
|
+
zmq_assert (!in_pipe);
|
142
|
+
in_pipe = inpipe_;
|
143
|
+
in_pipe->set_event_sink (this);
|
144
|
+
}
|
145
|
+
|
146
|
+
if (outpipe_) {
|
147
|
+
zmq_assert (!out_pipe);
|
148
|
+
out_pipe = outpipe_;
|
149
|
+
out_pipe->set_event_sink (this);
|
150
|
+
}
|
151
|
+
|
152
|
+
// If we are already terminating, terminate the pipes straight away.
|
153
|
+
if (state == terminating) {
|
154
|
+
if (in_pipe) {
|
155
|
+
in_pipe->terminate ();
|
156
|
+
register_term_acks (1);
|
157
|
+
}
|
158
|
+
if (out_pipe) {
|
159
|
+
out_pipe->terminate ();
|
160
|
+
register_term_acks (1);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
void zmq::session_t::delimited (reader_t *pipe_)
|
166
|
+
{
|
167
|
+
zmq_assert (in_pipe == pipe_);
|
168
|
+
zmq_assert (!delimiter_processed);
|
169
|
+
delimiter_processed = true;
|
170
|
+
|
171
|
+
// If we are in process of being closed, but still waiting for all
|
172
|
+
// pending messeges being sent, we can terminate here.
|
173
|
+
if (state == pending)
|
174
|
+
proceed_with_term ();
|
175
|
+
}
|
176
|
+
|
177
|
+
void zmq::session_t::terminated (reader_t *pipe_)
|
178
|
+
{
|
179
|
+
zmq_assert (in_pipe == pipe_);
|
180
|
+
in_pipe = NULL;
|
181
|
+
if (state == terminating)
|
182
|
+
unregister_term_ack ();
|
183
|
+
}
|
184
|
+
|
185
|
+
void zmq::session_t::terminated (writer_t *pipe_)
|
186
|
+
{
|
187
|
+
zmq_assert (out_pipe == pipe_);
|
188
|
+
out_pipe = NULL;
|
189
|
+
if (state == terminating)
|
190
|
+
unregister_term_ack ();
|
191
|
+
}
|
192
|
+
|
193
|
+
void zmq::session_t::activated (reader_t *pipe_)
|
194
|
+
{
|
195
|
+
zmq_assert (in_pipe == pipe_);
|
196
|
+
|
197
|
+
if (likely (engine != NULL))
|
198
|
+
engine->activate_out ();
|
199
|
+
else
|
200
|
+
in_pipe->check_read ();
|
201
|
+
}
|
202
|
+
|
203
|
+
void zmq::session_t::activated (writer_t *pipe_)
|
204
|
+
{
|
205
|
+
zmq_assert (out_pipe == pipe_);
|
206
|
+
if (engine)
|
207
|
+
engine->activate_in ();
|
208
|
+
}
|
209
|
+
|
210
|
+
void zmq::session_t::process_plug ()
|
211
|
+
{
|
212
|
+
}
|
213
|
+
|
214
|
+
void zmq::session_t::process_attach (i_engine *engine_,
|
215
|
+
const blob_t &peer_identity_)
|
216
|
+
{
|
217
|
+
// If some other object (e.g. init) notifies us that the connection failed
|
218
|
+
// we need to start the reconnection process.
|
219
|
+
if (!engine_) {
|
220
|
+
zmq_assert (!engine);
|
221
|
+
detached ();
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
|
225
|
+
// If we are already terminating, we destroy the engine straight away.
|
226
|
+
// Note that we don't have to unplug it before deleting as it's not
|
227
|
+
// yet plugged to the session.
|
228
|
+
if (state == terminating) {
|
229
|
+
delete engine_;
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
|
233
|
+
// If the session already has an engine attached, destroy new one.
|
234
|
+
// Note new engine is not plugged in yet, we don't have to unplug it.
|
235
|
+
if (engine) {
|
236
|
+
log ("DPID: duplicate peer identity - disconnecting peer");
|
237
|
+
delete engine_;
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
|
241
|
+
// Check whether the required pipes already exist. If not so, we'll
|
242
|
+
// create them and bind them to the socket object.
|
243
|
+
if (!pipes_attached) {
|
244
|
+
zmq_assert (!in_pipe && !out_pipe);
|
245
|
+
pipes_attached = true;
|
246
|
+
reader_t *socket_reader = NULL;
|
247
|
+
writer_t *socket_writer = NULL;
|
248
|
+
|
249
|
+
// Create the pipes, as required.
|
250
|
+
if (options.requires_in) {
|
251
|
+
create_pipe (socket, this, options.hwm, options.swap, &socket_reader,
|
252
|
+
&out_pipe);
|
253
|
+
out_pipe->set_event_sink (this);
|
254
|
+
}
|
255
|
+
if (options.requires_out) {
|
256
|
+
create_pipe (this, socket, options.hwm, options.swap, &in_pipe,
|
257
|
+
&socket_writer);
|
258
|
+
in_pipe->set_event_sink (this);
|
259
|
+
}
|
260
|
+
|
261
|
+
// Bind the pipes to the socket object.
|
262
|
+
if (socket_reader || socket_writer)
|
263
|
+
send_bind (socket, socket_reader, socket_writer, peer_identity_);
|
264
|
+
}
|
265
|
+
|
266
|
+
// Plug in the engine.
|
267
|
+
engine = engine_;
|
268
|
+
engine->plug (io_thread, this);
|
269
|
+
|
270
|
+
// Trigger the notfication about the attachment.
|
271
|
+
attached (peer_identity_);
|
272
|
+
}
|
273
|
+
|
274
|
+
void zmq::session_t::detach ()
|
275
|
+
{
|
276
|
+
// Engine is dead. Let's forget about it.
|
277
|
+
engine = NULL;
|
278
|
+
|
279
|
+
// Remove any half-done messages from the pipes.
|
280
|
+
clean_pipes ();
|
281
|
+
|
282
|
+
// Send the event to the derived class.
|
283
|
+
detached ();
|
284
|
+
|
285
|
+
// Just in case, there's only a delimiter in the inbound pipe.
|
286
|
+
if (in_pipe)
|
287
|
+
in_pipe->check_read ();
|
288
|
+
}
|
289
|
+
|
290
|
+
void zmq::session_t::process_term (int linger_)
|
291
|
+
{
|
292
|
+
zmq_assert (state == active);
|
293
|
+
state = pending;
|
294
|
+
|
295
|
+
// If linger is set to zero, we can terminate the session straight away
|
296
|
+
// not waiting for the pending messages to be sent.
|
297
|
+
if (linger_ == 0) {
|
298
|
+
proceed_with_term ();
|
299
|
+
return;
|
300
|
+
}
|
301
|
+
|
302
|
+
// If there's finite linger value, set up a timer.
|
303
|
+
if (linger_ > 0) {
|
304
|
+
zmq_assert (!has_linger_timer);
|
305
|
+
add_timer (linger_, linger_timer_id);
|
306
|
+
has_linger_timer = true;
|
307
|
+
}
|
308
|
+
|
309
|
+
// If there's no engine and there's only delimiter in the pipe it wouldn't
|
310
|
+
// be ever read. Thus we check for it explicitly.
|
311
|
+
if (in_pipe)
|
312
|
+
in_pipe->check_read ();
|
313
|
+
|
314
|
+
// If there's no in pipe there are no pending messages to send.
|
315
|
+
// We can proceed with the shutdown straight away. Also, if there is
|
316
|
+
// inbound pipe, but the delimiter was already processed, we can
|
317
|
+
// terminate immediately. Alternatively, if the derived session type have
|
318
|
+
// called 'terminate' we'll finish straight away.
|
319
|
+
if (!options.requires_out || delimiter_processed || force_terminate ||
|
320
|
+
(!options.immediate_connect && !in_pipe))
|
321
|
+
proceed_with_term ();
|
322
|
+
}
|
323
|
+
|
324
|
+
void zmq::session_t::timer_event (int id_)
|
325
|
+
{
|
326
|
+
// Linger period expired. We can proceed with termination even though
|
327
|
+
// there are still pending messages to be sent.
|
328
|
+
zmq_assert (id_ == linger_timer_id);
|
329
|
+
has_linger_timer = false;
|
330
|
+
proceed_with_term ();
|
331
|
+
}
|
332
|
+
|
333
|
+
bool zmq::session_t::register_session (const blob_t &name_, session_t *session_)
|
334
|
+
{
|
335
|
+
return socket->register_session (name_, session_);
|
336
|
+
}
|
337
|
+
|
338
|
+
void zmq::session_t::unregister_session (const blob_t &name_)
|
339
|
+
{
|
340
|
+
socket->unregister_session (name_);
|
341
|
+
}
|
342
|
+
|
343
|
+
void zmq::session_t::terminate ()
|
344
|
+
{
|
345
|
+
force_terminate = true;
|
346
|
+
own_t::terminate ();
|
347
|
+
}
|