rbczmq 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (437) hide show
  1. checksums.yaml +8 -8
  2. data/.gitmodules +1 -1
  3. data/CHANGELOG.rdoc +4 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.rdoc +5 -4
  6. data/ext/czmq/.gitignore +5 -0
  7. data/ext/czmq/.travis.yml +10 -1
  8. data/ext/czmq/AUTHORS +2 -0
  9. data/ext/czmq/COPYING.LESSER +3 -0
  10. data/ext/czmq/Makefile.am +13 -3
  11. data/ext/czmq/NEWS +132 -0
  12. data/ext/czmq/README.md +1553 -615
  13. data/ext/czmq/README.txt +188 -72
  14. data/ext/czmq/addons/Makefile.am +9 -0
  15. data/ext/czmq/addons/makecert.c +72 -0
  16. data/ext/czmq/builds/mingw32/Makefile.mingw32 +11 -3
  17. data/ext/czmq/builds/msvc/.gitignore +4 -1
  18. data/ext/czmq/builds/msvc/czmq.vcproj +4 -0
  19. data/ext/czmq/builds/msvc/czmq.vcxproj +6 -1
  20. data/ext/czmq/builds/msvc/czmq.vcxproj.filters +4 -1
  21. data/ext/{zeromq/cmake/Modules/zmq_version.cpp → czmq/builds/msvc/platform.h} +10 -9
  22. data/ext/czmq/configure.ac +64 -5
  23. data/ext/czmq/doc/Makefile.am +8 -1
  24. data/ext/czmq/doc/mkmans +17 -0
  25. data/ext/czmq/doc/zauth.txt +191 -0
  26. data/ext/czmq/doc/zbeacon.txt +13 -22
  27. data/ext/czmq/doc/zcert.txt +122 -0
  28. data/ext/czmq/doc/zcertstore.txt +107 -0
  29. data/ext/czmq/doc/zchunk.txt +77 -0
  30. data/ext/czmq/doc/zclock.txt +8 -0
  31. data/ext/czmq/doc/zconfig.txt +9 -63
  32. data/ext/czmq/doc/zctx.txt +26 -7
  33. data/ext/czmq/doc/zdir.txt +83 -0
  34. data/ext/czmq/doc/zfile.txt +130 -35
  35. data/ext/czmq/doc/zframe.txt +6 -39
  36. data/ext/czmq/doc/zhash.txt +55 -10
  37. data/ext/czmq/doc/zlist.txt +2 -4
  38. data/ext/czmq/doc/zloop.txt +7 -1
  39. data/ext/czmq/doc/zmsg.txt +75 -32
  40. data/ext/czmq/doc/zpoller.txt +88 -0
  41. data/ext/czmq/doc/zsocket.txt +50 -1
  42. data/ext/czmq/doc/zsockopt.txt +185 -251
  43. data/ext/czmq/doc/zstr.txt +14 -3
  44. data/ext/czmq/doc/zsys.txt +89 -1
  45. data/ext/czmq/doc/ztree.txt +21 -11
  46. data/ext/czmq/examples/security/LICENSE +18 -0
  47. data/ext/czmq/examples/security/README.txt +9 -0
  48. data/ext/czmq/examples/security/grasslands.c +29 -0
  49. data/ext/czmq/examples/security/hello.c +10 -0
  50. data/ext/czmq/examples/security/ironhouse.c +55 -0
  51. data/ext/czmq/examples/security/ironhouse2.c +103 -0
  52. data/ext/czmq/examples/security/stonehouse.c +51 -0
  53. data/ext/czmq/examples/security/strawhouse.c +44 -0
  54. data/ext/czmq/examples/security/woodhouse.c +40 -0
  55. data/ext/czmq/images/README_1.png +0 -0
  56. data/ext/czmq/images/README_2.png +0 -0
  57. data/ext/czmq/include/czmq.h +10 -4
  58. data/ext/czmq/include/czmq_prelude.h +42 -42
  59. data/ext/czmq/include/zauth.h +97 -0
  60. data/ext/czmq/include/zbeacon.h +0 -5
  61. data/ext/czmq/include/zcert.h +118 -0
  62. data/ext/czmq/include/zcertstore.h +78 -0
  63. data/ext/czmq/include/zchunk.h +87 -0
  64. data/ext/czmq/include/zclock.h +4 -0
  65. data/ext/czmq/include/zconfig.h +21 -12
  66. data/ext/czmq/include/zctx.h +34 -11
  67. data/ext/czmq/include/zdir.h +90 -0
  68. data/ext/czmq/include/zfile.h +104 -25
  69. data/ext/czmq/include/zframe.h +7 -20
  70. data/ext/czmq/include/zhash.h +13 -0
  71. data/ext/czmq/include/zlist.h +0 -4
  72. data/ext/czmq/include/zloop.h +5 -5
  73. data/ext/czmq/include/zmsg.h +59 -29
  74. data/ext/czmq/include/zmutex.h +5 -0
  75. data/ext/czmq/include/zpoller.h +72 -0
  76. data/ext/czmq/include/zsocket.h +12 -15
  77. data/ext/czmq/include/zsockopt.h +124 -121
  78. data/ext/czmq/include/zstr.h +12 -9
  79. data/ext/czmq/include/zsys.h +50 -2
  80. data/ext/czmq/mkdoc +1 -1
  81. data/ext/czmq/model/sockopts.xml +101 -21
  82. data/ext/czmq/scripts/sockopts.gsl +95 -41
  83. data/ext/czmq/src/Makefile.am +13 -0
  84. data/ext/czmq/src/czmq_selftest.c +16 -10
  85. data/ext/czmq/src/selftest +2 -2
  86. data/ext/czmq/src/zauth.c +714 -0
  87. data/ext/czmq/src/zbeacon.c +27 -35
  88. data/ext/czmq/src/zcert.c +463 -0
  89. data/ext/czmq/src/zcertstore.c +265 -0
  90. data/ext/czmq/src/zchunk.c +207 -0
  91. data/ext/czmq/src/zclock.c +18 -0
  92. data/ext/czmq/src/zconfig.c +116 -99
  93. data/ext/czmq/src/zctx.c +103 -18
  94. data/ext/czmq/src/zdir.c +409 -0
  95. data/ext/czmq/src/zfile.c +421 -130
  96. data/ext/czmq/src/zframe.c +28 -127
  97. data/ext/czmq/src/zhash.c +255 -139
  98. data/ext/czmq/src/zlist.c +2 -8
  99. data/ext/czmq/src/zloop.c +40 -13
  100. data/ext/czmq/src/zmsg.c +109 -141
  101. data/ext/czmq/src/zmutex.c +27 -1
  102. data/ext/czmq/src/zpoller.c +218 -0
  103. data/ext/czmq/src/zsocket.c +53 -66
  104. data/ext/czmq/src/zsockopt.c +2337 -682
  105. data/ext/czmq/src/zstr.c +48 -118
  106. data/ext/czmq/src/zsys.c +270 -3
  107. data/ext/czmq/src/zthread.c +2 -2
  108. data/ext/czmq/src/ztree.c +179 -180
  109. data/ext/rbczmq/beacon.c +1 -1
  110. data/ext/rbczmq/context.c +12 -3
  111. data/ext/rbczmq/context.h +7 -0
  112. data/ext/rbczmq/extconf.rb +13 -4
  113. data/ext/rbczmq/pollitem.c +1 -1
  114. data/ext/rbczmq/socket.c +34 -24
  115. data/ext/rbczmq/socket.h +3 -2
  116. data/ext/zeromq/AUTHORS +17 -3
  117. data/ext/zeromq/CMakeLists.txt +742 -339
  118. data/ext/zeromq/COPYING.LESSER +2 -0
  119. data/ext/zeromq/Makefile.am +3 -3
  120. data/ext/zeromq/NEWS +130 -1
  121. data/ext/zeromq/{README → README.md} +8 -9
  122. data/ext/zeromq/builds/cmake/Modules/FindAsciiDoc.cmake +24 -0
  123. data/ext/zeromq/builds/cmake/Modules/TestZMQVersion.cmake +18 -0
  124. data/ext/zeromq/builds/cmake/Modules/ZMQSourceRunChecks.cmake +129 -0
  125. data/ext/zeromq/{cmake → builds/cmake}/NSIS.template32.in +1 -1
  126. data/ext/zeromq/{cmake → builds/cmake}/NSIS.template64.in +1 -1
  127. data/ext/zeromq/builds/cmake/platform.hpp.in +88 -0
  128. data/ext/zeromq/builds/mingw32/Makefile.mingw32 +47 -0
  129. data/ext/zeromq/{src/i_msg_sink.hpp → builds/mingw32/platform.hpp} +10 -21
  130. data/ext/zeromq/builds/msvc/Makefile.am +5 -2
  131. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +1 -1
  132. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat11.vcxproj +91 -0
  133. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +2 -0
  134. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +21 -1
  135. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr11.vcxproj +111 -0
  136. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +1 -1
  137. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat11.vcxproj +91 -0
  138. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +2 -0
  139. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +21 -1
  140. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr11.vcxproj +111 -0
  141. data/ext/zeromq/builds/msvc/errno.cpp +1 -1
  142. data/ext/zeromq/builds/msvc/errno.hpp +1 -1
  143. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +176 -174
  144. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +21 -1
  145. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat11.vcxproj +110 -0
  146. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +176 -174
  147. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +21 -1
  148. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr11.vcxproj +110 -0
  149. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +997 -804
  150. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +78 -2
  151. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +42 -6
  152. data/ext/zeromq/builds/msvc/libzmq/libzmq11.vcxproj +362 -0
  153. data/ext/zeromq/builds/msvc/msvc.sln +6 -0
  154. data/ext/zeromq/builds/msvc/msvc10.sln +36 -2
  155. data/ext/zeromq/builds/msvc/msvc11.sln +150 -0
  156. data/ext/zeromq/builds/msvc/properties/Static.props +15 -0
  157. data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +0 -1
  158. data/ext/zeromq/builds/msvc/properties/ZeroMQ_Static.props +23 -0
  159. data/ext/zeromq/builds/redhat/zeromq.spec.in +2 -1
  160. data/ext/zeromq/{configure.in → configure.ac} +74 -15
  161. data/ext/zeromq/doc/Makefile.am +6 -4
  162. data/ext/zeromq/doc/zmq.txt +30 -3
  163. data/ext/zeromq/doc/zmq_bind.txt +2 -2
  164. data/ext/zeromq/doc/zmq_close.txt +2 -2
  165. data/ext/zeromq/doc/zmq_connect.txt +9 -7
  166. data/ext/zeromq/doc/zmq_ctx_destroy.txt +4 -3
  167. data/ext/zeromq/doc/zmq_ctx_get.txt +8 -3
  168. data/ext/zeromq/doc/zmq_ctx_new.txt +3 -2
  169. data/ext/zeromq/doc/zmq_ctx_set.txt +13 -1
  170. data/ext/zeromq/doc/zmq_ctx_shutdown.txt +52 -0
  171. data/ext/zeromq/doc/zmq_ctx_term.txt +67 -0
  172. data/ext/zeromq/doc/zmq_curve.txt +92 -0
  173. data/ext/zeromq/doc/zmq_curve_keypair.txt +56 -0
  174. data/ext/zeromq/doc/zmq_disconnect.txt +2 -2
  175. data/ext/zeromq/doc/zmq_epgm.txt +5 -4
  176. data/ext/zeromq/doc/zmq_errno.txt +2 -2
  177. data/ext/zeromq/doc/zmq_getsockopt.txt +149 -24
  178. data/ext/zeromq/doc/zmq_init.txt +2 -2
  179. data/ext/zeromq/doc/zmq_inproc.txt +2 -2
  180. data/ext/zeromq/doc/zmq_ipc.txt +10 -5
  181. data/ext/zeromq/doc/zmq_msg_close.txt +4 -3
  182. data/ext/zeromq/doc/zmq_msg_copy.txt +2 -2
  183. data/ext/zeromq/doc/zmq_msg_data.txt +2 -2
  184. data/ext/zeromq/doc/zmq_msg_get.txt +3 -3
  185. data/ext/zeromq/doc/zmq_msg_init.txt +2 -2
  186. data/ext/zeromq/doc/zmq_msg_init_data.txt +2 -2
  187. data/ext/zeromq/doc/zmq_msg_init_size.txt +2 -2
  188. data/ext/zeromq/doc/zmq_msg_more.txt +6 -4
  189. data/ext/zeromq/doc/zmq_msg_move.txt +2 -2
  190. data/ext/zeromq/doc/zmq_msg_recv.txt +3 -4
  191. data/ext/zeromq/doc/zmq_msg_send.txt +10 -7
  192. data/ext/zeromq/doc/zmq_msg_set.txt +2 -1
  193. data/ext/zeromq/doc/zmq_msg_size.txt +2 -2
  194. data/ext/zeromq/doc/zmq_null.txt +27 -0
  195. data/ext/zeromq/doc/zmq_pgm.txt +5 -4
  196. data/ext/zeromq/doc/zmq_plain.txt +37 -0
  197. data/ext/zeromq/doc/zmq_poll.txt +2 -6
  198. data/ext/zeromq/doc/zmq_proxy.txt +2 -1
  199. data/ext/zeromq/doc/zmq_recv.txt +2 -5
  200. data/ext/zeromq/doc/zmq_recvmsg.txt +3 -5
  201. data/ext/zeromq/doc/zmq_send.txt +9 -7
  202. data/ext/zeromq/doc/zmq_send_const.txt +103 -0
  203. data/ext/zeromq/doc/zmq_sendmsg.txt +8 -8
  204. data/ext/zeromq/doc/zmq_setsockopt.txt +291 -37
  205. data/ext/zeromq/doc/zmq_socket.txt +92 -21
  206. data/ext/zeromq/doc/zmq_socket_monitor.txt +102 -131
  207. data/ext/zeromq/doc/zmq_strerror.txt +3 -2
  208. data/ext/zeromq/doc/zmq_tcp.txt +4 -2
  209. data/ext/zeromq/doc/zmq_term.txt +3 -3
  210. data/ext/zeromq/doc/zmq_unbind.txt +2 -2
  211. data/ext/zeromq/doc/zmq_version.txt +3 -2
  212. data/ext/zeromq/doc/zmq_z85_decode.txt +50 -0
  213. data/ext/zeromq/doc/zmq_z85_encode.txt +57 -0
  214. data/ext/zeromq/foreign/openpgm/libpgm-5.2.122~dfsg.tar.gz +0 -0
  215. data/ext/zeromq/include/zmq.h +179 -136
  216. data/ext/zeromq/include/zmq_utils.h +44 -3
  217. data/ext/zeromq/perf/inproc_lat.cpp +2 -4
  218. data/ext/zeromq/perf/inproc_thr.cpp +1 -1
  219. data/ext/zeromq/perf/local_lat.cpp +1 -3
  220. data/ext/zeromq/perf/local_thr.cpp +1 -3
  221. data/ext/zeromq/perf/remote_lat.cpp +1 -3
  222. data/ext/zeromq/perf/remote_thr.cpp +1 -8
  223. data/ext/zeromq/src/Makefile.am +26 -7
  224. data/ext/zeromq/src/address.cpp +7 -8
  225. data/ext/zeromq/src/address.hpp +1 -2
  226. data/ext/zeromq/src/array.hpp +1 -3
  227. data/ext/zeromq/src/atomic_counter.hpp +11 -3
  228. data/ext/zeromq/src/atomic_ptr.hpp +9 -3
  229. data/ext/zeromq/src/blob.hpp +2 -2
  230. data/ext/zeromq/src/clock.cpp +3 -4
  231. data/ext/zeromq/src/clock.hpp +1 -2
  232. data/ext/zeromq/src/command.hpp +2 -3
  233. data/ext/zeromq/src/config.hpp +1 -3
  234. data/ext/zeromq/src/ctx.cpp +154 -15
  235. data/ext/zeromq/src/ctx.hpp +34 -3
  236. data/ext/zeromq/src/curve_client.cpp +410 -0
  237. data/ext/zeromq/src/curve_client.hpp +109 -0
  238. data/ext/zeromq/src/curve_server.cpp +629 -0
  239. data/ext/zeromq/src/curve_server.hpp +120 -0
  240. data/ext/zeromq/src/dbuffer.hpp +134 -0
  241. data/ext/zeromq/src/dealer.cpp +52 -60
  242. data/ext/zeromq/src/dealer.hpp +12 -26
  243. data/ext/zeromq/src/decoder.hpp +27 -102
  244. data/ext/zeromq/src/devpoll.cpp +1 -3
  245. data/ext/zeromq/src/devpoll.hpp +1 -3
  246. data/ext/zeromq/src/dist.cpp +17 -15
  247. data/ext/zeromq/src/dist.hpp +5 -6
  248. data/ext/zeromq/src/encoder.hpp +32 -52
  249. data/ext/zeromq/src/epoll.cpp +1 -3
  250. data/ext/zeromq/src/epoll.hpp +1 -3
  251. data/ext/zeromq/src/err.cpp +2 -4
  252. data/ext/zeromq/src/err.hpp +7 -4
  253. data/ext/zeromq/src/fd.hpp +1 -2
  254. data/ext/zeromq/src/fq.cpp +2 -5
  255. data/ext/zeromq/src/fq.hpp +2 -4
  256. data/ext/zeromq/src/i_decoder.hpp +11 -9
  257. data/ext/zeromq/src/i_encoder.hpp +7 -11
  258. data/ext/zeromq/src/i_engine.hpp +3 -3
  259. data/ext/zeromq/src/i_poll_events.hpp +1 -3
  260. data/ext/zeromq/src/io_object.cpp +1 -3
  261. data/ext/zeromq/src/io_object.hpp +1 -3
  262. data/ext/zeromq/src/io_thread.cpp +1 -3
  263. data/ext/zeromq/src/io_thread.hpp +1 -3
  264. data/ext/zeromq/src/ip.cpp +46 -5
  265. data/ext/zeromq/src/ip.hpp +7 -4
  266. data/ext/zeromq/src/ipc_address.cpp +13 -2
  267. data/ext/zeromq/src/ipc_address.hpp +1 -2
  268. data/ext/zeromq/src/ipc_connecter.cpp +3 -3
  269. data/ext/zeromq/src/ipc_connecter.hpp +1 -2
  270. data/ext/zeromq/src/ipc_listener.cpp +15 -10
  271. data/ext/zeromq/src/ipc_listener.hpp +1 -2
  272. data/ext/zeromq/src/kqueue.cpp +11 -3
  273. data/ext/zeromq/src/kqueue.hpp +7 -3
  274. data/ext/zeromq/src/lb.cpp +13 -11
  275. data/ext/zeromq/src/lb.hpp +10 -5
  276. data/ext/zeromq/src/libzmq.pc.cmake.in +10 -0
  277. data/ext/zeromq/src/likely.hpp +1 -2
  278. data/ext/zeromq/src/mailbox.cpp +1 -4
  279. data/ext/zeromq/src/mailbox.hpp +8 -3
  280. data/ext/zeromq/src/mechanism.cpp +163 -0
  281. data/ext/zeromq/src/mechanism.hpp +101 -0
  282. data/ext/zeromq/src/msg.cpp +38 -18
  283. data/ext/zeromq/src/msg.hpp +19 -7
  284. data/ext/zeromq/src/mtrie.cpp +16 -14
  285. data/ext/zeromq/src/mtrie.hpp +1 -3
  286. data/ext/zeromq/src/mutex.hpp +42 -3
  287. data/ext/zeromq/src/null_mechanism.cpp +282 -0
  288. data/ext/zeromq/src/null_mechanism.hpp +65 -0
  289. data/ext/zeromq/src/object.cpp +29 -3
  290. data/ext/zeromq/src/object.hpp +8 -5
  291. data/ext/zeromq/src/options.cpp +557 -485
  292. data/ext/zeromq/src/options.hpp +38 -24
  293. data/ext/zeromq/src/own.cpp +1 -2
  294. data/ext/zeromq/src/own.hpp +1 -2
  295. data/ext/zeromq/src/pair.cpp +8 -25
  296. data/ext/zeromq/src/pair.hpp +5 -22
  297. data/ext/zeromq/src/pgm_receiver.cpp +80 -67
  298. data/ext/zeromq/src/pgm_receiver.hpp +11 -10
  299. data/ext/zeromq/src/pgm_sender.cpp +37 -16
  300. data/ext/zeromq/src/pgm_sender.hpp +12 -6
  301. data/ext/zeromq/src/pgm_socket.cpp +8 -8
  302. data/ext/zeromq/src/pgm_socket.hpp +1 -4
  303. data/ext/zeromq/src/pipe.cpp +110 -72
  304. data/ext/zeromq/src/pipe.hpp +36 -27
  305. data/ext/zeromq/src/plain_mechanism.cpp +482 -0
  306. data/ext/zeromq/src/plain_mechanism.hpp +88 -0
  307. data/ext/zeromq/src/poll.cpp +1 -3
  308. data/ext/zeromq/src/poll.hpp +1 -3
  309. data/ext/zeromq/src/poller.hpp +1 -3
  310. data/ext/zeromq/src/poller_base.cpp +3 -3
  311. data/ext/zeromq/src/poller_base.hpp +1 -2
  312. data/ext/zeromq/src/precompiled.cpp +1 -2
  313. data/ext/zeromq/src/precompiled.hpp +1 -2
  314. data/ext/zeromq/src/proxy.cpp +1 -2
  315. data/ext/zeromq/src/proxy.hpp +1 -2
  316. data/ext/zeromq/src/pub.cpp +2 -16
  317. data/ext/zeromq/src/pub.hpp +2 -19
  318. data/ext/zeromq/src/pull.cpp +7 -24
  319. data/ext/zeromq/src/pull.hpp +4 -21
  320. data/ext/zeromq/src/push.cpp +8 -22
  321. data/ext/zeromq/src/push.hpp +4 -21
  322. data/ext/zeromq/src/random.cpp +1 -2
  323. data/ext/zeromq/src/random.hpp +1 -2
  324. data/ext/zeromq/src/raw_decoder.cpp +63 -0
  325. data/ext/zeromq/src/raw_decoder.hpp +66 -0
  326. data/ext/zeromq/src/raw_encoder.cpp +40 -0
  327. data/ext/zeromq/src/raw_encoder.hpp +60 -0
  328. data/ext/zeromq/src/reaper.cpp +12 -2
  329. data/ext/zeromq/src/reaper.hpp +6 -2
  330. data/ext/zeromq/src/rep.cpp +7 -21
  331. data/ext/zeromq/src/rep.hpp +3 -20
  332. data/ext/zeromq/src/req.cpp +132 -38
  333. data/ext/zeromq/src/req.hpp +27 -8
  334. data/ext/zeromq/src/router.cpp +109 -65
  335. data/ext/zeromq/src/router.hpp +9 -23
  336. data/ext/zeromq/src/select.cpp +1 -3
  337. data/ext/zeromq/src/select.hpp +1 -3
  338. data/ext/zeromq/src/session_base.cpp +164 -118
  339. data/ext/zeromq/src/session_base.hpp +29 -22
  340. data/ext/zeromq/src/signaler.cpp +127 -19
  341. data/ext/zeromq/src/signaler.hpp +20 -3
  342. data/ext/zeromq/src/socket_base.cpp +167 -134
  343. data/ext/zeromq/src/socket_base.hpp +18 -20
  344. data/ext/zeromq/src/stdint.hpp +1 -2
  345. data/ext/zeromq/src/stream.cpp +257 -0
  346. data/ext/zeromq/src/stream.hpp +97 -0
  347. data/ext/zeromq/src/stream_engine.cpp +405 -157
  348. data/ext/zeromq/src/stream_engine.hpp +72 -23
  349. data/ext/zeromq/src/sub.cpp +5 -18
  350. data/ext/zeromq/src/sub.hpp +2 -19
  351. data/ext/zeromq/src/tcp.cpp +23 -3
  352. data/ext/zeromq/src/tcp.hpp +7 -3
  353. data/ext/zeromq/src/tcp_address.cpp +35 -46
  354. data/ext/zeromq/src/tcp_address.hpp +7 -12
  355. data/ext/zeromq/src/tcp_connecter.cpp +10 -5
  356. data/ext/zeromq/src/tcp_connecter.hpp +1 -3
  357. data/ext/zeromq/src/tcp_listener.cpp +19 -8
  358. data/ext/zeromq/src/tcp_listener.hpp +1 -3
  359. data/ext/zeromq/src/thread.cpp +2 -4
  360. data/ext/zeromq/src/thread.hpp +1 -3
  361. data/ext/zeromq/src/trie.cpp +122 -125
  362. data/ext/zeromq/src/trie.hpp +1 -4
  363. data/ext/zeromq/src/v1_decoder.cpp +77 -91
  364. data/ext/zeromq/src/v1_decoder.hpp +10 -21
  365. data/ext/zeromq/src/v1_encoder.cpp +24 -62
  366. data/ext/zeromq/src/v1_encoder.hpp +7 -18
  367. data/ext/zeromq/src/v2_decoder.cpp +142 -0
  368. data/ext/zeromq/src/v2_decoder.hpp +57 -0
  369. data/ext/zeromq/src/v2_encoder.cpp +67 -0
  370. data/ext/zeromq/src/{i_msg_source.hpp → v2_encoder.hpp} +20 -15
  371. data/ext/zeromq/src/{v1_protocol.hpp → v2_protocol.hpp} +7 -11
  372. data/ext/zeromq/src/windows.hpp +2 -4
  373. data/ext/zeromq/src/wire.hpp +5 -6
  374. data/ext/zeromq/src/xpub.cpp +37 -46
  375. data/ext/zeromq/src/xpub.hpp +7 -23
  376. data/ext/zeromq/src/xsub.cpp +26 -40
  377. data/ext/zeromq/src/xsub.hpp +5 -21
  378. data/ext/zeromq/src/ypipe.hpp +3 -4
  379. data/ext/zeromq/src/ypipe_base.hpp +44 -0
  380. data/ext/zeromq/src/ypipe_conflate.hpp +127 -0
  381. data/ext/zeromq/src/yqueue.hpp +3 -7
  382. data/ext/zeromq/src/zmq.cpp +76 -96
  383. data/ext/zeromq/src/zmq_utils.cpp +146 -8
  384. data/ext/zeromq/tests/Makefile.am +56 -8
  385. data/ext/zeromq/tests/test_abstract_ipc.cpp +57 -0
  386. data/ext/zeromq/tests/test_conflate.cpp +75 -0
  387. data/ext/zeromq/tests/test_connect_resolve.cpp +14 -15
  388. data/ext/zeromq/tests/test_ctx_destroy.cpp +90 -0
  389. data/ext/zeromq/tests/test_ctx_options.cpp +52 -0
  390. data/ext/zeromq/tests/test_disconnect_inproc.cpp +35 -30
  391. data/ext/zeromq/tests/test_fork.cpp +81 -0
  392. data/ext/zeromq/tests/test_hwm.cpp +251 -35
  393. data/ext/zeromq/tests/test_immediate.cpp +229 -0
  394. data/ext/zeromq/tests/test_inproc_connect.cpp +339 -0
  395. data/ext/zeromq/tests/test_invalid_rep.cpp +9 -13
  396. data/ext/zeromq/tests/test_iov.cpp +106 -0
  397. data/ext/zeromq/tests/test_issue_566.cpp +85 -0
  398. data/ext/zeromq/tests/test_last_endpoint.cpp +14 -18
  399. data/ext/zeromq/tests/test_linger.cpp +93 -0
  400. data/ext/zeromq/tests/test_monitor.cpp +112 -129
  401. data/ext/zeromq/tests/test_msg_flags.cpp +17 -16
  402. data/ext/zeromq/tests/test_pair_inproc.cpp +25 -7
  403. data/ext/zeromq/tests/test_pair_ipc.cpp +4 -7
  404. data/ext/zeromq/tests/test_pair_tcp.cpp +4 -8
  405. data/ext/zeromq/tests/test_probe_router.cpp +72 -0
  406. data/ext/zeromq/tests/test_req_correlate.cpp +177 -0
  407. data/ext/zeromq/tests/test_req_relaxed.cpp +116 -0
  408. data/ext/zeromq/tests/test_reqrep_device.cpp +9 -17
  409. data/ext/zeromq/tests/test_reqrep_inproc.cpp +4 -7
  410. data/ext/zeromq/tests/test_reqrep_ipc.cpp +4 -7
  411. data/ext/zeromq/tests/test_reqrep_tcp.cpp +4 -8
  412. data/ext/zeromq/tests/test_router_mandatory.cpp +41 -22
  413. data/ext/zeromq/tests/test_security_curve.cpp +212 -0
  414. data/ext/zeromq/tests/test_security_null.cpp +148 -0
  415. data/ext/zeromq/tests/test_security_plain.cpp +150 -0
  416. data/ext/zeromq/tests/test_shutdown_stress.cpp +10 -23
  417. data/ext/zeromq/tests/test_spec_dealer.cpp +254 -0
  418. data/ext/zeromq/tests/test_spec_pushpull.cpp +293 -0
  419. data/ext/zeromq/tests/test_spec_rep.cpp +155 -0
  420. data/ext/zeromq/tests/test_spec_req.cpp +253 -0
  421. data/ext/zeromq/tests/test_spec_router.cpp +204 -0
  422. data/ext/zeromq/tests/test_stream.cpp +228 -0
  423. data/ext/zeromq/tests/test_sub_forward.cpp +14 -22
  424. data/ext/zeromq/tests/test_system.cpp +82 -0
  425. data/ext/zeromq/tests/test_term_endpoint.cpp +17 -31
  426. data/ext/zeromq/tests/test_timeo.cpp +34 -78
  427. data/ext/zeromq/tests/testutil.hpp +211 -26
  428. data/ext/zeromq/tools/Makefile.am +9 -0
  429. data/ext/zeromq/tools/curve_keygen.c +58 -0
  430. data/lib/zmq/version.rb +1 -1
  431. data/test/test_socket.rb +4 -3
  432. metadata +114 -15
  433. data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +0 -35
  434. data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
  435. data/ext/zeromq/src/decoder.cpp +0 -166
  436. data/ext/zeromq/src/encoder.cpp +0 -102
  437. data/ext/zeromq/tests/test_connect_delay.cpp +0 -260
@@ -1,7 +1,5 @@
1
1
  /*
2
- Copyright (c) 2009-2011 250bpm s.r.o.
3
- Copyright (c) 2007-2009 iMatix Corporation
4
- Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
2
+ Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
5
3
 
6
4
  This file is part of 0MQ.
7
5
 
@@ -21,19 +19,21 @@
21
19
 
22
20
  #include "platform.hpp"
23
21
 
24
- #include "../include/zmq_utils.h"
25
-
26
- #include <stdlib.h>
27
-
28
- #include "stdint.hpp"
29
22
  #include "clock.hpp"
30
23
  #include "err.hpp"
24
+ #include "thread.hpp"
25
+ #include <assert.h>
26
+ #include "../include/zmq_utils.h"
31
27
 
32
28
  #if !defined ZMQ_HAVE_WINDOWS
33
29
  #include <unistd.h>
34
30
  #else
35
31
  #include "windows.hpp"
36
32
  #endif
33
+ #ifdef HAVE_LIBSODIUM
34
+ # include <sodium.h>
35
+ #endif
36
+
37
37
 
38
38
  void zmq_sleep (int seconds_)
39
39
  {
@@ -59,3 +59,141 @@ unsigned long zmq_stopwatch_stop (void *watch_)
59
59
  free (watch_);
60
60
  return (unsigned long) (end - start);
61
61
  }
62
+
63
+ void *zmq_threadstart(zmq_thread_fn* func, void* arg)
64
+ {
65
+ zmq::thread_t* thread = new zmq::thread_t;
66
+ thread->start(func, arg);
67
+ return thread;
68
+ }
69
+
70
+ void zmq_threadclose(void* thread)
71
+ {
72
+ zmq::thread_t* pThread = static_cast<zmq::thread_t*>(thread);
73
+ pThread->stop();
74
+ delete pThread;
75
+ }
76
+
77
+ // Z85 codec, taken from 0MQ RFC project, implements RFC32 Z85 encoding
78
+
79
+ // Maps base 256 to base 85
80
+ static char encoder [85 + 1] = {
81
+ "0123456789" "abcdefghij" "klmnopqrst" "uvwxyzABCD"
82
+ "EFGHIJKLMN" "OPQRSTUVWX" "YZ.-:+=^!/" "*?&<>()[]{"
83
+ "}@%$#"
84
+ };
85
+
86
+ // Maps base 85 to base 256
87
+ // We chop off lower 32 and higher 128 ranges
88
+ static uint8_t decoder [96] = {
89
+ 0x00, 0x44, 0x00, 0x54, 0x53, 0x52, 0x48, 0x00,
90
+ 0x4B, 0x4C, 0x46, 0x41, 0x00, 0x3F, 0x3E, 0x45,
91
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
92
+ 0x08, 0x09, 0x40, 0x00, 0x49, 0x42, 0x4A, 0x47,
93
+ 0x51, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A,
94
+ 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
95
+ 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
96
+ 0x3B, 0x3C, 0x3D, 0x4D, 0x00, 0x4E, 0x43, 0x00,
97
+ 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
98
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
99
+ 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
100
+ 0x21, 0x22, 0x23, 0x4F, 0x00, 0x50, 0x00, 0x00
101
+ };
102
+
103
+ // --------------------------------------------------------------------------
104
+ // Encode a binary frame as a string; destination string MUST be at least
105
+ // size * 5 / 4 bytes long plus 1 byte for the null terminator. Returns
106
+ // dest. Size must be a multiple of 4.
107
+ // Returns NULL and sets errno = EINVAL for invalid input.
108
+
109
+ char *zmq_z85_encode (char *dest, uint8_t *data, size_t size)
110
+ {
111
+ if (size % 4 != 0) {
112
+ errno = EINVAL;
113
+ return NULL;
114
+ }
115
+ unsigned int char_nbr = 0;
116
+ unsigned int byte_nbr = 0;
117
+ uint32_t value = 0;
118
+ while (byte_nbr < size) {
119
+ // Accumulate value in base 256 (binary)
120
+ value = value * 256 + data [byte_nbr++];
121
+ if (byte_nbr % 4 == 0) {
122
+ // Output value in base 85
123
+ unsigned int divisor = 85 * 85 * 85 * 85;
124
+ while (divisor) {
125
+ dest [char_nbr++] = encoder [value / divisor % 85];
126
+ divisor /= 85;
127
+ }
128
+ value = 0;
129
+ }
130
+ }
131
+ assert (char_nbr == size * 5 / 4);
132
+ dest [char_nbr] = 0;
133
+ return dest;
134
+ }
135
+
136
+
137
+ // --------------------------------------------------------------------------
138
+ // Decode an encoded string into a binary frame; dest must be at least
139
+ // strlen (string) * 4 / 5 bytes long. Returns dest. strlen (string)
140
+ // must be a multiple of 5.
141
+ // Returns NULL and sets errno = EINVAL for invalid input.
142
+
143
+ uint8_t *zmq_z85_decode (uint8_t *dest, char *string)
144
+ {
145
+
146
+ if (strlen (string) % 5 != 0) {
147
+ errno = EINVAL;
148
+ return NULL;
149
+ }
150
+ unsigned int byte_nbr = 0;
151
+ unsigned int char_nbr = 0;
152
+ uint32_t value = 0;
153
+ while (char_nbr < strlen (string)) {
154
+ // Accumulate value in base 85
155
+ value = value * 85 + decoder [(uint8_t) string [char_nbr++] - 32];
156
+ if (char_nbr % 5 == 0) {
157
+ // Output value in base 256
158
+ unsigned int divisor = 256 * 256 * 256;
159
+ while (divisor) {
160
+ dest [byte_nbr++] = value / divisor % 256;
161
+ divisor /= 256;
162
+ }
163
+ value = 0;
164
+ }
165
+ }
166
+ assert (byte_nbr == strlen (string) * 4 / 5);
167
+ return dest;
168
+ }
169
+
170
+ // --------------------------------------------------------------------------
171
+ // Generate a public/private keypair with libsodium.
172
+ // Generated keys will be 40 byte z85-encoded strings.
173
+ // Returns 0 on success, -1 on failure, setting errno.
174
+ // Sets errno = ENOTSUP in the absence of libsodium.
175
+
176
+ int zmq_curve_keypair (char* z85_public_key, char *z85_secret_key)
177
+ {
178
+ #ifdef HAVE_LIBSODIUM
179
+ # if crypto_box_PUBLICKEYBYTES != 32 \
180
+ || crypto_box_SECRETKEYBYTES != 32
181
+ # error "libsodium not built correctly"
182
+ # endif
183
+
184
+ uint8_t public_key [32];
185
+ uint8_t secret_key [32];
186
+
187
+ int rc = crypto_box_keypair (public_key, secret_key);
188
+ // is there a sensible errno to set here?
189
+ if (rc) return rc;
190
+
191
+ zmq_z85_encode (z85_public_key, public_key, 32);
192
+ zmq_z85_encode (z85_secret_key, secret_key, 32);
193
+
194
+ return 0;
195
+ #else // requires libsodium
196
+ errno = ENOTSUP;
197
+ return -1;
198
+ #endif
199
+ }
@@ -3,7 +3,8 @@ INCLUDES = -I$(top_builddir)/include \
3
3
 
4
4
  LDADD = $(top_builddir)/src/libzmq.la
5
5
 
6
- noinst_PROGRAMS = test_pair_inproc \
6
+ noinst_PROGRAMS = test_system \
7
+ test_pair_inproc \
7
8
  test_pair_tcp \
8
9
  test_reqrep_inproc \
9
10
  test_reqrep_tcp \
@@ -13,21 +14,42 @@ noinst_PROGRAMS = test_pair_inproc \
13
14
  test_invalid_rep \
14
15
  test_msg_flags \
15
16
  test_connect_resolve \
16
- test_connect_delay \
17
+ test_immediate \
17
18
  test_last_endpoint \
18
19
  test_term_endpoint \
20
+ test_linger \
19
21
  test_monitor \
20
22
  test_router_mandatory \
21
- test_disconnect_inproc
22
-
23
+ test_probe_router \
24
+ test_stream \
25
+ test_disconnect_inproc \
26
+ test_ctx_options \
27
+ test_ctx_destroy \
28
+ test_security_null \
29
+ test_security_plain \
30
+ test_security_curve \
31
+ test_iov \
32
+ test_spec_req \
33
+ test_spec_rep \
34
+ test_spec_dealer \
35
+ test_spec_router \
36
+ test_spec_pushpull \
37
+ test_req_correlate \
38
+ test_req_relaxed \
39
+ test_conflate \
40
+ test_inproc_connect \
41
+ test_issue_566 \
42
+ test_abstract_ipc
23
43
 
24
44
  if !ON_MINGW
25
45
  noinst_PROGRAMS += test_shutdown_stress \
26
46
  test_pair_ipc \
27
47
  test_reqrep_ipc \
28
- test_timeo
48
+ test_timeo \
49
+ test_fork
29
50
  endif
30
51
 
52
+ test_system_SOURCES = test_system.cpp
31
53
  test_pair_inproc_SOURCES = test_pair_inproc.cpp testutil.hpp
32
54
  test_pair_tcp_SOURCES = test_pair_tcp.cpp testutil.hpp
33
55
  test_reqrep_inproc_SOURCES = test_reqrep_inproc.cpp testutil.hpp
@@ -36,20 +58,46 @@ test_hwm_SOURCES = test_hwm.cpp
36
58
  test_reqrep_device_SOURCES = test_reqrep_device.cpp
37
59
  test_sub_forward_SOURCES = test_sub_forward.cpp
38
60
  test_invalid_rep_SOURCES = test_invalid_rep.cpp
61
+ test_linger_SOURCES = test_linger.cpp
39
62
  test_msg_flags_SOURCES = test_msg_flags.cpp
40
63
  test_connect_resolve_SOURCES = test_connect_resolve.cpp
41
- test_connect_delay_SOURCES = test_connect_delay.cpp
64
+ test_immediate_SOURCES = test_immediate.cpp
42
65
  test_last_endpoint_SOURCES = test_last_endpoint.cpp
43
66
  test_term_endpoint_SOURCES = test_term_endpoint.cpp
44
67
  test_monitor_SOURCES = test_monitor.cpp
45
- test_disconnect_inproc_SOURCES = test_disconnect_inproc.cpp
46
68
  test_router_mandatory_SOURCES = test_router_mandatory.cpp
47
-
69
+ test_probe_router_SOURCES = test_probe_router.cpp
70
+ test_stream_SOURCES = test_stream.cpp
71
+ test_disconnect_inproc_SOURCES = test_disconnect_inproc.cpp
72
+ test_ctx_options_SOURCES = test_ctx_options.cpp
73
+ test_iov_SOURCES = test_iov.cpp
74
+ test_ctx_destroy_SOURCES = test_ctx_destroy.cpp
75
+ test_security_null_SOURCES = test_security_null.cpp
76
+ test_security_plain_SOURCES = test_security_plain.cpp
77
+ test_security_curve_SOURCES = test_security_curve.cpp
78
+ test_spec_req_SOURCES = test_spec_req.cpp
79
+ test_spec_rep_SOURCES = test_spec_rep.cpp
80
+ test_spec_dealer_SOURCES = test_spec_dealer.cpp
81
+ test_spec_router_SOURCES = test_spec_router.cpp
82
+ test_spec_pushpull_SOURCES = test_spec_pushpull.cpp
83
+ test_req_correlate_SOURCES = test_req_correlate.cpp
84
+ test_req_relaxed_SOURCES = test_req_relaxed.cpp
85
+ test_conflate_SOURCES = test_conflate.cpp
86
+ test_inproc_connect_SOURCES = test_inproc_connect.cpp
87
+ test_issue_566_SOURCES = test_issue_566.cpp
88
+ test_abstract_ipc_SOURCES = test_abstract_ipc.cpp
48
89
  if !ON_MINGW
49
90
  test_shutdown_stress_SOURCES = test_shutdown_stress.cpp
50
91
  test_pair_ipc_SOURCES = test_pair_ipc.cpp testutil.hpp
51
92
  test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
52
93
  test_timeo_SOURCES = test_timeo.cpp
94
+ test_fork_SOURCES = test_fork.cpp
53
95
  endif
54
96
 
97
+ # Run the test cases
55
98
  TESTS = $(noinst_PROGRAMS)
99
+ XFAIL_TESTS = test_linger
100
+
101
+ if !ON_LINUX
102
+ XFAIL_TESTS += test_abstract_ipc
103
+ endif
@@ -0,0 +1,57 @@
1
+ /*
2
+ Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
3
+
4
+ This file is part of 0MQ.
5
+
6
+ 0MQ is free software; you can redistribute it and/or modify it under
7
+ the terms of the GNU Lesser General Public License as published by
8
+ the Free Software Foundation; either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ 0MQ is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Lesser General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Lesser General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ #include "testutil.hpp"
21
+
22
+ int main (void)
23
+ {
24
+ setup_test_environment();
25
+ void *ctx = zmq_ctx_new ();
26
+ assert (ctx);
27
+
28
+ void *sb = zmq_socket (ctx, ZMQ_PAIR);
29
+ assert (sb);
30
+ int rc = zmq_bind (sb, "ipc://@/tmp/tester");
31
+ assert (rc == 0);
32
+
33
+ char endpoint[200];
34
+ size_t size = sizeof(endpoint);
35
+ rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size);
36
+ assert (rc == 0);
37
+ rc = strncmp(endpoint, "ipc://@/tmp/tester", size);
38
+ assert (rc == 0);
39
+
40
+ void *sc = zmq_socket (ctx, ZMQ_PAIR);
41
+ assert (sc);
42
+ rc = zmq_connect (sc, "ipc://@/tmp/tester");
43
+ assert (rc == 0);
44
+
45
+ bounce (sb, sc);
46
+
47
+ rc = zmq_close (sc);
48
+ assert (rc == 0);
49
+
50
+ rc = zmq_close (sb);
51
+ assert (rc == 0);
52
+
53
+ rc = zmq_ctx_term (ctx);
54
+ assert (rc == 0);
55
+
56
+ return 0 ;
57
+ }
@@ -0,0 +1,75 @@
1
+ /*
2
+ Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
3
+
4
+ This file is part of 0MQ.
5
+
6
+ 0MQ is free software; you can redistribute it and/or modify it under
7
+ the terms of the GNU Lesser General Public License as published by
8
+ the Free Software Foundation; either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ 0MQ is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Lesser General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Lesser General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ #include "testutil.hpp"
21
+
22
+ int main (int argc, char *argv [])
23
+ {
24
+ const char *bind_to = "tcp://127.0.0.1:5555";
25
+
26
+ int rc;
27
+
28
+ void* ctx = zmq_init (1);
29
+ assert (ctx);
30
+
31
+ void* s_in = zmq_socket (ctx, ZMQ_PULL);
32
+ assert (s_in);
33
+
34
+ int conflate = 1;
35
+ rc = zmq_setsockopt (s_in, ZMQ_CONFLATE, &conflate, sizeof(conflate));
36
+ assert (rc == 0);
37
+
38
+ rc = zmq_bind (s_in, bind_to);
39
+ assert (rc == 0);
40
+
41
+ void* s_out = zmq_socket (ctx, ZMQ_PUSH);
42
+ assert (s_out);
43
+
44
+ rc = zmq_connect (s_out, bind_to);
45
+ assert (rc == 0);
46
+
47
+ int message_count = 20;
48
+
49
+ for (int j = 0; j < message_count; ++j) {
50
+ rc = zmq_send(s_out, (void*)&j, sizeof(int), 0);
51
+ if (rc < 0) {
52
+ printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
53
+ return -1;
54
+ }
55
+ }
56
+
57
+ zmq_sleep (1);
58
+
59
+ int payload_recved = 0;
60
+ rc = zmq_recv(s_in, (void*)&payload_recved, sizeof(int), 0);
61
+ assert (rc > 0);
62
+ assert (payload_recved == message_count - 1);
63
+
64
+
65
+ rc = zmq_close (s_in);
66
+ assert (rc == 0);
67
+
68
+ rc = zmq_close (s_out);
69
+ assert (rc == 0);
70
+
71
+ rc = zmq_term (ctx);
72
+ assert (rc == 0);
73
+
74
+ return 0;
75
+ }
@@ -1,6 +1,5 @@
1
1
  /*
2
- Copyright (c) 2012 Spotify AB
3
- Copyright (c) 2012 Other contributors as noted in the AUTHORS file
2
+ Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
4
3
 
5
4
  This file is part of 0MQ.
6
5
 
@@ -18,36 +17,36 @@
18
17
  along with this program. If not, see <http://www.gnu.org/licenses/>.
19
18
  */
20
19
 
21
- #include "../include/zmq.h"
22
- #include <stdio.h>
23
- #include <errno.h>
24
-
25
- #undef NDEBUG
26
- #include <assert.h>
20
+ #include "testutil.hpp"
27
21
 
28
22
  int main (void)
29
23
  {
30
- fprintf (stderr, "test_connect_resolve running...\n");
31
-
32
- void *ctx = zmq_init (1);
24
+ setup_test_environment();
25
+ void *ctx = zmq_ctx_new ();
33
26
  assert (ctx);
34
27
 
35
- // Create pair of socket, each with high watermark of 2. Thus the total
36
- // buffer space should be 4 messages.
37
28
  void *sock = zmq_socket (ctx, ZMQ_PUB);
38
29
  assert (sock);
39
30
 
40
31
  int rc = zmq_connect (sock, "tcp://localhost:1234");
41
32
  assert (rc == 0);
42
33
 
43
- rc = zmq_connect (sock, "tcp://0mq.is.teh.best:1234");
34
+ rc = zmq_connect (sock, "tcp://localhost:invalid");
44
35
  assert (rc == -1);
45
36
  assert (errno == EINVAL);
46
37
 
38
+ rc = zmq_connect (sock, "tcp://in val id:1234");
39
+ assert (rc == -1);
40
+ assert (errno == EINVAL);
41
+
42
+ rc = zmq_connect (sock, "invalid://localhost:1234");
43
+ assert (rc == -1);
44
+ assert (errno == EPROTONOSUPPORT);
45
+
47
46
  rc = zmq_close (sock);
48
47
  assert (rc == 0);
49
48
 
50
- rc = zmq_term (ctx);
49
+ rc = zmq_ctx_term (ctx);
51
50
  assert (rc == 0);
52
51
 
53
52
  return 0;