couchbase 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (901) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/ext/CMakeLists.txt +86 -169
  4. data/ext/build_version.hxx.in +3 -2
  5. data/ext/cmake/Backtrace.cmake +35 -0
  6. data/ext/cmake/BuildTracing.cmake +6 -0
  7. data/ext/cmake/Cache.cmake +29 -0
  8. data/ext/cmake/CompilerWarnings.cmake +78 -0
  9. data/ext/cmake/PreventInSourceBuilds.cmake +18 -0
  10. data/ext/cmake/Sanitizers.cmake +66 -0
  11. data/ext/cmake/StandardProjectSettings.cmake +40 -0
  12. data/ext/cmake/StaticAnalyzers.cmake +37 -0
  13. data/ext/cmake/Testing.cmake +52 -0
  14. data/ext/cmake/ThirdPartyDependencies.cmake +20 -0
  15. data/ext/cmake/VersionInfo.cmake +37 -0
  16. data/ext/couchbase/bucket.hxx +37 -12
  17. data/ext/couchbase/capabilities.hxx +117 -0
  18. data/ext/couchbase/cbcrypto/cbcrypto.cc +15 -15
  19. data/ext/couchbase/cluster.hxx +34 -2
  20. data/ext/couchbase/cluster_options.hxx +1 -0
  21. data/ext/couchbase/configuration.hxx +228 -52
  22. data/ext/couchbase/couchbase.cxx +914 -35
  23. data/ext/couchbase/diagnostics.hxx +251 -0
  24. data/ext/couchbase/document_id.hxx +3 -1
  25. data/ext/couchbase/errors.hxx +10 -1
  26. data/ext/couchbase/io/http_command.hxx +11 -7
  27. data/ext/couchbase/io/http_context.hxx +37 -0
  28. data/ext/couchbase/io/http_message.hxx +9 -0
  29. data/ext/couchbase/io/http_parser.hxx +2 -0
  30. data/ext/couchbase/io/http_session.hxx +100 -14
  31. data/ext/couchbase/io/http_session_manager.hxx +65 -5
  32. data/ext/couchbase/io/mcbp_command.hxx +16 -7
  33. data/ext/couchbase/io/mcbp_session.hxx +193 -51
  34. data/ext/couchbase/io/query_cache.hxx +61 -0
  35. data/ext/couchbase/io/retry_context.hxx +1 -2
  36. data/ext/couchbase/io/retry_orchestrator.hxx +16 -0
  37. data/ext/couchbase/io/retry_strategy.hxx +1 -1
  38. data/ext/couchbase/io/streams.hxx +61 -10
  39. data/ext/couchbase/operations.hxx +13 -0
  40. data/ext/couchbase/operations/analytics_dataset_create.hxx +1 -1
  41. data/ext/couchbase/operations/analytics_dataset_drop.hxx +1 -1
  42. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +1 -1
  43. data/ext/couchbase/operations/analytics_dataverse_create.hxx +1 -1
  44. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +1 -1
  45. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +1 -1
  46. data/ext/couchbase/operations/analytics_index_create.hxx +1 -1
  47. data/ext/couchbase/operations/analytics_index_drop.hxx +1 -1
  48. data/ext/couchbase/operations/analytics_index_get_all.hxx +1 -1
  49. data/ext/couchbase/operations/analytics_link_connect.hxx +1 -1
  50. data/ext/couchbase/operations/analytics_link_disconnect.hxx +1 -1
  51. data/ext/couchbase/operations/bucket_create.hxx +11 -5
  52. data/ext/couchbase/operations/bucket_drop.hxx +1 -1
  53. data/ext/couchbase/operations/bucket_flush.hxx +1 -1
  54. data/ext/couchbase/operations/bucket_get.hxx +1 -1
  55. data/ext/couchbase/operations/bucket_get_all.hxx +1 -1
  56. data/ext/couchbase/operations/bucket_settings.hxx +43 -4
  57. data/ext/couchbase/operations/bucket_update.hxx +11 -5
  58. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +1 -1
  59. data/ext/couchbase/operations/collection_create.hxx +3 -1
  60. data/ext/couchbase/operations/collection_drop.hxx +1 -1
  61. data/ext/couchbase/operations/collections_manifest_get.hxx +70 -0
  62. data/ext/couchbase/operations/document_analytics.hxx +6 -1
  63. data/ext/couchbase/operations/document_get_projected.hxx +1 -1
  64. data/ext/couchbase/operations/document_query.hxx +85 -8
  65. data/ext/couchbase/operations/document_search.hxx +14 -4
  66. data/ext/couchbase/operations/document_view.hxx +1 -1
  67. data/ext/couchbase/operations/group_drop.hxx +71 -0
  68. data/ext/couchbase/operations/group_get.hxx +75 -0
  69. data/ext/couchbase/operations/group_get_all.hxx +70 -0
  70. data/ext/couchbase/operations/group_upsert.hxx +118 -0
  71. data/ext/couchbase/operations/query_index_build_deferred.hxx +1 -1
  72. data/ext/couchbase/operations/query_index_create.hxx +1 -1
  73. data/ext/couchbase/operations/query_index_drop.hxx +1 -1
  74. data/ext/couchbase/operations/query_index_get_all.hxx +3 -2
  75. data/ext/couchbase/operations/rbac.hxx +276 -0
  76. data/ext/couchbase/operations/role_get_all.hxx +70 -0
  77. data/ext/couchbase/operations/scope_create.hxx +6 -2
  78. data/ext/couchbase/operations/scope_drop.hxx +1 -1
  79. data/ext/couchbase/operations/scope_get_all.hxx +1 -1
  80. data/ext/couchbase/operations/search_get_stats.hxx +59 -0
  81. data/ext/couchbase/operations/search_index_analyze_document.hxx +1 -1
  82. data/ext/couchbase/operations/search_index_control_ingest.hxx +1 -1
  83. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +1 -1
  84. data/ext/couchbase/operations/search_index_control_query.hxx +1 -1
  85. data/ext/couchbase/operations/search_index_drop.hxx +1 -1
  86. data/ext/couchbase/operations/search_index_get.hxx +1 -1
  87. data/ext/couchbase/operations/search_index_get_all.hxx +1 -1
  88. data/ext/couchbase/operations/search_index_get_documents_count.hxx +24 -16
  89. data/ext/couchbase/operations/search_index_get_stats.hxx +81 -0
  90. data/ext/couchbase/operations/search_index_upsert.hxx +1 -1
  91. data/ext/couchbase/operations/user_drop.hxx +72 -0
  92. data/ext/couchbase/operations/user_get.hxx +76 -0
  93. data/ext/couchbase/operations/user_get_all.hxx +71 -0
  94. data/ext/couchbase/operations/user_upsert.hxx +125 -0
  95. data/ext/couchbase/operations/view_index_drop.hxx +1 -1
  96. data/ext/couchbase/operations/view_index_get.hxx +1 -1
  97. data/ext/couchbase/operations/view_index_get_all.hxx +1 -1
  98. data/ext/couchbase/operations/view_index_upsert.hxx +1 -1
  99. data/ext/couchbase/origin.hxx +4 -4
  100. data/ext/couchbase/platform/terminate_handler.cc +5 -4
  101. data/ext/couchbase/protocol/client_opcode.hxx +38 -38
  102. data/ext/couchbase/protocol/client_response.hxx +2 -2
  103. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +6 -3
  104. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +3 -1
  105. data/ext/couchbase/protocol/magic.hxx +6 -6
  106. data/ext/couchbase/protocol/server_opcode.hxx +2 -2
  107. data/ext/couchbase/protocol/status.hxx +57 -57
  108. data/ext/couchbase/service_type.hxx +1 -1
  109. data/ext/couchbase/utils/connection_string.hxx +12 -3
  110. data/ext/couchbase/version.hxx +1 -1
  111. data/ext/extconf.rb +21 -9
  112. data/ext/test/test_helper.hxx +141 -0
  113. data/ext/test/test_helper_native.hxx +59 -0
  114. data/ext/test/test_helper_ruby.hxx +72 -0
  115. data/ext/test/test_native_diagnostics.cxx +385 -0
  116. data/ext/test/test_native_trivial_crud.cxx +83 -0
  117. data/ext/test/test_ruby_trivial_crud.cxx +35 -0
  118. data/ext/test/test_ruby_trivial_query.cxx +34 -0
  119. data/ext/third_party/asio/asio/include/asio.hpp +35 -0
  120. data/ext/third_party/asio/asio/include/asio/any_io_executor.hpp +71 -0
  121. data/ext/third_party/asio/asio/include/asio/associated_allocator.hpp +1 -7
  122. data/ext/third_party/asio/asio/include/asio/associated_executor.hpp +36 -19
  123. data/ext/third_party/asio/asio/include/asio/async_result.hpp +1 -8
  124. data/ext/third_party/asio/asio/include/asio/awaitable.hpp +14 -4
  125. data/ext/third_party/asio/asio/include/asio/basic_datagram_socket.hpp +12 -7
  126. data/ext/third_party/asio/asio/include/asio/basic_deadline_timer.hpp +4 -4
  127. data/ext/third_party/asio/asio/include/asio/basic_raw_socket.hpp +11 -7
  128. data/ext/third_party/asio/asio/include/asio/basic_seq_packet_socket.hpp +9 -4
  129. data/ext/third_party/asio/asio/include/asio/basic_serial_port.hpp +6 -6
  130. data/ext/third_party/asio/asio/include/asio/basic_signal_set.hpp +4 -4
  131. data/ext/third_party/asio/asio/include/asio/basic_socket.hpp +5 -5
  132. data/ext/third_party/asio/asio/include/asio/basic_socket_acceptor.hpp +13 -7
  133. data/ext/third_party/asio/asio/include/asio/basic_stream_socket.hpp +7 -3
  134. data/ext/third_party/asio/asio/include/asio/basic_waitable_timer.hpp +52 -4
  135. data/ext/third_party/asio/asio/include/asio/bind_executor.hpp +10 -15
  136. data/ext/third_party/asio/asio/include/asio/buffer.hpp +6 -4
  137. data/ext/third_party/asio/asio/include/asio/co_spawn.hpp +380 -9
  138. data/ext/third_party/asio/asio/include/asio/defer.hpp +4 -1
  139. data/ext/third_party/asio/asio/include/asio/detached.hpp +50 -0
  140. data/ext/third_party/asio/asio/include/asio/detail/atomic_count.hpp +19 -0
  141. data/ext/third_party/asio/asio/include/asio/detail/bind_handler.hpp +144 -26
  142. data/ext/third_party/asio/asio/include/asio/detail/blocking_executor_op.hpp +107 -0
  143. data/ext/third_party/asio/asio/include/asio/detail/buffer_sequence_adapter.hpp +106 -0
  144. data/ext/third_party/asio/asio/include/asio/detail/bulk_executor_op.hpp +88 -0
  145. data/ext/third_party/asio/asio/include/asio/detail/completion_handler.hpp +10 -5
  146. data/ext/third_party/asio/asio/include/asio/detail/conditionally_enabled_event.hpp +8 -0
  147. data/ext/third_party/asio/asio/include/asio/detail/config.hpp +360 -37
  148. data/ext/third_party/asio/asio/include/asio/detail/deadline_timer_service.hpp +17 -2
  149. data/ext/third_party/asio/asio/include/asio/detail/descriptor_ops.hpp +24 -6
  150. data/ext/third_party/asio/asio/include/asio/detail/descriptor_read_op.hpp +32 -14
  151. data/ext/third_party/asio/asio/include/asio/detail/descriptor_write_op.hpp +32 -14
  152. data/ext/third_party/asio/asio/include/asio/detail/executor_function.hpp +133 -34
  153. data/ext/third_party/asio/asio/include/asio/detail/handler_alloc_helpers.hpp +42 -0
  154. data/ext/third_party/asio/asio/include/asio/detail/handler_invoke_helpers.hpp +23 -0
  155. data/ext/third_party/asio/asio/include/asio/detail/handler_tracking.hpp +26 -0
  156. data/ext/third_party/asio/asio/include/asio/detail/handler_work.hpp +370 -45
  157. data/ext/third_party/asio/asio/include/asio/detail/impl/descriptor_ops.ipp +208 -74
  158. data/ext/third_party/asio/asio/include/asio/detail/impl/handler_tracking.ipp +39 -1
  159. data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_serial_port_service.ipp +12 -15
  160. data/ext/third_party/asio/asio/include/asio/detail/impl/scheduler.ipp +37 -0
  161. data/ext/third_party/asio/asio/include/asio/detail/impl/signal_set_service.ipp +2 -1
  162. data/ext/third_party/asio/asio/include/asio/detail/impl/socket_ops.ipp +661 -274
  163. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_executor_service.hpp +210 -4
  164. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.hpp +8 -9
  165. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.ipp +5 -4
  166. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_io_context.ipp +15 -6
  167. data/ext/third_party/asio/asio/include/asio/detail/io_object_impl.hpp +32 -50
  168. data/ext/third_party/asio/asio/include/asio/detail/memory.hpp +3 -0
  169. data/ext/third_party/asio/asio/include/asio/detail/null_event.hpp +6 -0
  170. data/ext/third_party/asio/asio/include/asio/detail/pop_options.hpp +1 -1
  171. data/ext/third_party/asio/asio/include/asio/detail/posix_event.hpp +13 -0
  172. data/ext/third_party/asio/asio/include/asio/detail/push_options.hpp +1 -1
  173. data/ext/third_party/asio/asio/include/asio/detail/reactive_descriptor_service.hpp +38 -13
  174. data/ext/third_party/asio/asio/include/asio/detail/reactive_null_buffers_op.hpp +12 -6
  175. data/ext/third_party/asio/asio/include/asio/detail/reactive_serial_port_service.hpp +2 -3
  176. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp +36 -24
  177. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_connect_op.hpp +17 -10
  178. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recv_op.hpp +38 -16
  179. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvfrom_op.hpp +36 -14
  180. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvmsg_op.hpp +21 -11
  181. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_send_op.hpp +43 -17
  182. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_sendto_op.hpp +39 -17
  183. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service.hpp +44 -21
  184. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service_base.hpp +41 -18
  185. data/ext/third_party/asio/asio/include/asio/detail/reactive_wait_op.hpp +12 -6
  186. data/ext/third_party/asio/asio/include/asio/detail/reactor_op.hpp +3 -1
  187. data/ext/third_party/asio/asio/include/asio/detail/resolve_endpoint_op.hpp +10 -8
  188. data/ext/third_party/asio/asio/include/asio/detail/resolve_query_op.hpp +11 -9
  189. data/ext/third_party/asio/asio/include/asio/detail/scheduler.hpp +8 -0
  190. data/ext/third_party/asio/asio/include/asio/detail/signal_handler.hpp +7 -5
  191. data/ext/third_party/asio/asio/include/asio/detail/socket_ops.hpp +46 -0
  192. data/ext/third_party/asio/asio/include/asio/detail/source_location.hpp +45 -0
  193. data/ext/third_party/asio/asio/include/asio/detail/std_event.hpp +12 -0
  194. data/ext/third_party/asio/asio/include/asio/detail/strand_executor_service.hpp +25 -1
  195. data/ext/third_party/asio/asio/include/asio/detail/strand_service.hpp +4 -1
  196. data/ext/third_party/asio/asio/include/asio/detail/thread_info_base.hpp +58 -0
  197. data/ext/third_party/asio/asio/include/asio/detail/type_traits.hpp +59 -0
  198. data/ext/third_party/asio/asio/include/asio/detail/variadic_templates.hpp +144 -1
  199. data/ext/third_party/asio/asio/include/asio/detail/wait_handler.hpp +9 -6
  200. data/ext/third_party/asio/asio/include/asio/detail/win_event.hpp +13 -0
  201. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_read_op.hpp +9 -5
  202. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_write_op.hpp +9 -5
  203. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_io_context.hpp +5 -1
  204. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_null_buffers_op.hpp +10 -6
  205. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_op.hpp +9 -5
  206. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp +18 -6
  207. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp +15 -11
  208. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_connect_op.hpp +10 -5
  209. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recv_op.hpp +8 -4
  210. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvfrom_op.hpp +8 -4
  211. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvmsg_op.hpp +8 -4
  212. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_send_op.hpp +8 -4
  213. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_wait_op.hpp +10 -5
  214. data/ext/third_party/asio/asio/include/asio/detail/winrt_resolve_op.hpp +8 -4
  215. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_connect_op.hpp +8 -4
  216. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_recv_op.hpp +8 -4
  217. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_send_op.hpp +8 -4
  218. data/ext/third_party/asio/asio/include/asio/detail/work_dispatcher.hpp +81 -6
  219. data/ext/third_party/asio/asio/include/asio/detail/wrapped_handler.hpp +45 -9
  220. data/ext/third_party/asio/asio/include/asio/dispatch.hpp +4 -1
  221. data/ext/third_party/asio/asio/include/asio/execution.hpp +48 -0
  222. data/ext/third_party/asio/asio/include/asio/execution/allocator.hpp +249 -0
  223. data/ext/third_party/asio/asio/include/asio/execution/any_executor.hpp +2264 -0
  224. data/ext/third_party/asio/asio/include/asio/execution/bad_executor.hpp +47 -0
  225. data/ext/third_party/asio/asio/include/asio/execution/blocking.hpp +1351 -0
  226. data/ext/third_party/asio/asio/include/asio/execution/blocking_adaptation.hpp +1064 -0
  227. data/ext/third_party/asio/asio/include/asio/execution/bulk_execute.hpp +390 -0
  228. data/ext/third_party/asio/asio/include/asio/execution/bulk_guarantee.hpp +1018 -0
  229. data/ext/third_party/asio/asio/include/asio/execution/connect.hpp +486 -0
  230. data/ext/third_party/asio/asio/include/asio/execution/context.hpp +185 -0
  231. data/ext/third_party/asio/asio/include/asio/execution/context_as.hpp +201 -0
  232. data/ext/third_party/asio/asio/include/asio/execution/detail/as_invocable.hpp +152 -0
  233. data/ext/third_party/asio/asio/include/asio/execution/detail/as_operation.hpp +105 -0
  234. data/ext/third_party/asio/asio/include/asio/execution/detail/as_receiver.hpp +128 -0
  235. data/ext/third_party/asio/asio/include/asio/execution/detail/bulk_sender.hpp +261 -0
  236. data/ext/third_party/asio/asio/include/asio/execution/detail/submit_receiver.hpp +233 -0
  237. data/ext/third_party/asio/asio/include/asio/execution/detail/void_receiver.hpp +90 -0
  238. data/ext/third_party/asio/asio/include/asio/execution/execute.hpp +264 -0
  239. data/ext/third_party/asio/asio/include/asio/execution/executor.hpp +238 -0
  240. data/ext/third_party/asio/asio/include/asio/execution/impl/bad_executor.ipp +40 -0
  241. data/ext/third_party/asio/asio/include/asio/execution/impl/receiver_invocation_error.ipp +36 -0
  242. data/ext/third_party/asio/asio/include/asio/execution/invocable_archetype.hpp +71 -0
  243. data/ext/third_party/asio/asio/include/asio/execution/mapping.hpp +917 -0
  244. data/ext/third_party/asio/asio/include/asio/execution/occupancy.hpp +178 -0
  245. data/ext/third_party/asio/asio/include/asio/execution/operation_state.hpp +94 -0
  246. data/ext/third_party/asio/asio/include/asio/execution/outstanding_work.hpp +721 -0
  247. data/ext/third_party/asio/asio/include/asio/execution/prefer_only.hpp +327 -0
  248. data/ext/third_party/asio/asio/include/asio/execution/receiver.hpp +280 -0
  249. data/ext/third_party/asio/asio/include/asio/execution/receiver_invocation_error.hpp +48 -0
  250. data/ext/third_party/asio/asio/include/asio/execution/relationship.hpp +720 -0
  251. data/ext/third_party/asio/asio/include/asio/execution/schedule.hpp +290 -0
  252. data/ext/third_party/asio/asio/include/asio/execution/scheduler.hpp +86 -0
  253. data/ext/third_party/asio/asio/include/asio/execution/sender.hpp +311 -0
  254. data/ext/third_party/asio/asio/include/asio/execution/set_done.hpp +253 -0
  255. data/ext/third_party/asio/asio/include/asio/execution/set_error.hpp +253 -0
  256. data/ext/third_party/asio/asio/include/asio/execution/set_value.hpp +486 -0
  257. data/ext/third_party/asio/asio/include/asio/execution/start.hpp +250 -0
  258. data/ext/third_party/asio/asio/include/asio/execution/submit.hpp +450 -0
  259. data/ext/third_party/asio/asio/include/asio/executor.hpp +7 -1
  260. data/ext/third_party/asio/asio/include/asio/executor_work_guard.hpp +126 -9
  261. data/ext/third_party/asio/asio/include/asio/handler_alloc_hook.hpp +28 -5
  262. data/ext/third_party/asio/asio/include/asio/handler_invoke_hook.hpp +29 -3
  263. data/ext/third_party/asio/asio/include/asio/impl/awaitable.hpp +14 -0
  264. data/ext/third_party/asio/asio/include/asio/impl/buffered_read_stream.hpp +44 -8
  265. data/ext/third_party/asio/asio/include/asio/impl/buffered_write_stream.hpp +44 -8
  266. data/ext/third_party/asio/asio/include/asio/impl/co_spawn.hpp +145 -7
  267. data/ext/third_party/asio/asio/include/asio/impl/compose.hpp +124 -22
  268. data/ext/third_party/asio/asio/include/asio/impl/connect.hpp +52 -8
  269. data/ext/third_party/asio/asio/include/asio/impl/defer.hpp +147 -12
  270. data/ext/third_party/asio/asio/include/asio/impl/dispatch.hpp +142 -12
  271. data/ext/third_party/asio/asio/include/asio/impl/executor.hpp +15 -101
  272. data/ext/third_party/asio/asio/include/asio/impl/executor.ipp +5 -0
  273. data/ext/third_party/asio/asio/include/asio/impl/handler_alloc_hook.ipp +13 -4
  274. data/ext/third_party/asio/asio/include/asio/impl/io_context.hpp +144 -57
  275. data/ext/third_party/asio/asio/include/asio/impl/multiple_exceptions.ipp +49 -0
  276. data/ext/third_party/asio/asio/include/asio/impl/post.hpp +147 -12
  277. data/ext/third_party/asio/asio/include/asio/impl/read.hpp +85 -18
  278. data/ext/third_party/asio/asio/include/asio/impl/read_at.hpp +59 -14
  279. data/ext/third_party/asio/asio/include/asio/impl/read_until.hpp +241 -56
  280. data/ext/third_party/asio/asio/include/asio/impl/redirect_error.hpp +22 -4
  281. data/ext/third_party/asio/asio/include/asio/impl/spawn.hpp +58 -22
  282. data/ext/third_party/asio/asio/include/asio/impl/src.hpp +3 -0
  283. data/ext/third_party/asio/asio/include/asio/impl/system_context.ipp +16 -4
  284. data/ext/third_party/asio/asio/include/asio/impl/system_executor.hpp +113 -12
  285. data/ext/third_party/asio/asio/include/asio/impl/thread_pool.hpp +260 -37
  286. data/ext/third_party/asio/asio/include/asio/impl/thread_pool.ipp +61 -7
  287. data/ext/third_party/asio/asio/include/asio/impl/use_awaitable.hpp +5 -2
  288. data/ext/third_party/asio/asio/include/asio/impl/use_future.hpp +147 -6
  289. data/ext/third_party/asio/asio/include/asio/impl/write.hpp +75 -14
  290. data/ext/third_party/asio/asio/include/asio/impl/write_at.hpp +53 -11
  291. data/ext/third_party/asio/asio/include/asio/io_context.hpp +706 -48
  292. data/ext/third_party/asio/asio/include/asio/io_context_strand.hpp +3 -1
  293. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver.hpp +4 -4
  294. data/ext/third_party/asio/asio/include/asio/is_applicable_property.hpp +61 -0
  295. data/ext/third_party/asio/asio/include/asio/multiple_exceptions.hpp +58 -0
  296. data/ext/third_party/asio/asio/include/asio/posix/basic_descriptor.hpp +4 -4
  297. data/ext/third_party/asio/asio/include/asio/posix/basic_stream_descriptor.hpp +5 -5
  298. data/ext/third_party/asio/asio/include/asio/post.hpp +4 -1
  299. data/ext/third_party/asio/asio/include/asio/prefer.hpp +656 -0
  300. data/ext/third_party/asio/asio/include/asio/query.hpp +296 -0
  301. data/ext/third_party/asio/asio/include/asio/read_until.hpp +6 -6
  302. data/ext/third_party/asio/asio/include/asio/require.hpp +524 -0
  303. data/ext/third_party/asio/asio/include/asio/require_concept.hpp +310 -0
  304. data/ext/third_party/asio/asio/include/asio/spawn.hpp +12 -4
  305. data/ext/third_party/asio/asio/include/asio/ssl/detail/buffered_handshake_op.hpp +5 -0
  306. data/ext/third_party/asio/asio/include/asio/ssl/detail/engine.hpp +5 -0
  307. data/ext/third_party/asio/asio/include/asio/ssl/detail/handshake_op.hpp +5 -0
  308. data/ext/third_party/asio/asio/include/asio/ssl/detail/impl/engine.ipp +16 -3
  309. data/ext/third_party/asio/asio/include/asio/ssl/detail/io.hpp +38 -4
  310. data/ext/third_party/asio/asio/include/asio/ssl/detail/read_op.hpp +5 -0
  311. data/ext/third_party/asio/asio/include/asio/ssl/detail/shutdown_op.hpp +5 -0
  312. data/ext/third_party/asio/asio/include/asio/ssl/detail/stream_core.hpp +36 -2
  313. data/ext/third_party/asio/asio/include/asio/ssl/detail/write_op.hpp +10 -1
  314. data/ext/third_party/asio/asio/include/asio/ssl/stream.hpp +15 -0
  315. data/ext/third_party/asio/asio/include/asio/static_thread_pool.hpp +31 -0
  316. data/ext/third_party/asio/asio/include/asio/strand.hpp +232 -9
  317. data/ext/third_party/asio/asio/include/asio/system_context.hpp +12 -3
  318. data/ext/third_party/asio/asio/include/asio/system_executor.hpp +557 -24
  319. data/ext/third_party/asio/asio/include/asio/thread_pool.hpp +913 -37
  320. data/ext/third_party/asio/asio/include/asio/traits/bulk_execute_free.hpp +114 -0
  321. data/ext/third_party/asio/asio/include/asio/traits/bulk_execute_member.hpp +114 -0
  322. data/ext/third_party/asio/asio/include/asio/traits/connect_free.hpp +112 -0
  323. data/ext/third_party/asio/asio/include/asio/traits/connect_member.hpp +112 -0
  324. data/ext/third_party/asio/asio/include/asio/traits/equality_comparable.hpp +100 -0
  325. data/ext/third_party/asio/asio/include/asio/traits/execute_free.hpp +108 -0
  326. data/ext/third_party/asio/asio/include/asio/traits/execute_member.hpp +108 -0
  327. data/ext/third_party/asio/asio/include/asio/traits/prefer_free.hpp +108 -0
  328. data/ext/third_party/asio/asio/include/asio/traits/prefer_member.hpp +108 -0
  329. data/ext/third_party/asio/asio/include/asio/traits/query_free.hpp +108 -0
  330. data/ext/third_party/asio/asio/include/asio/traits/query_member.hpp +108 -0
  331. data/ext/third_party/asio/asio/include/asio/traits/query_static_constexpr_member.hpp +108 -0
  332. data/ext/third_party/asio/asio/include/asio/traits/require_concept_free.hpp +108 -0
  333. data/ext/third_party/asio/asio/include/asio/traits/require_concept_member.hpp +108 -0
  334. data/ext/third_party/asio/asio/include/asio/traits/require_free.hpp +108 -0
  335. data/ext/third_party/asio/asio/include/asio/traits/require_member.hpp +108 -0
  336. data/ext/third_party/asio/asio/include/asio/traits/schedule_free.hpp +108 -0
  337. data/ext/third_party/asio/asio/include/asio/traits/schedule_member.hpp +108 -0
  338. data/ext/third_party/asio/asio/include/asio/traits/set_done_free.hpp +108 -0
  339. data/ext/third_party/asio/asio/include/asio/traits/set_done_member.hpp +108 -0
  340. data/ext/third_party/asio/asio/include/asio/traits/set_error_free.hpp +112 -0
  341. data/ext/third_party/asio/asio/include/asio/traits/set_error_member.hpp +112 -0
  342. data/ext/third_party/asio/asio/include/asio/traits/set_value_free.hpp +234 -0
  343. data/ext/third_party/asio/asio/include/asio/traits/set_value_member.hpp +234 -0
  344. data/ext/third_party/asio/asio/include/asio/traits/start_free.hpp +108 -0
  345. data/ext/third_party/asio/asio/include/asio/traits/start_member.hpp +108 -0
  346. data/ext/third_party/asio/asio/include/asio/traits/static_query.hpp +108 -0
  347. data/ext/third_party/asio/asio/include/asio/traits/static_require.hpp +123 -0
  348. data/ext/third_party/asio/asio/include/asio/traits/static_require_concept.hpp +123 -0
  349. data/ext/third_party/asio/asio/include/asio/traits/submit_free.hpp +112 -0
  350. data/ext/third_party/asio/asio/include/asio/traits/submit_member.hpp +112 -0
  351. data/ext/third_party/asio/asio/include/asio/ts/executor.hpp +1 -0
  352. data/ext/third_party/asio/asio/include/asio/ts/netfwd.hpp +67 -8
  353. data/ext/third_party/asio/asio/include/asio/use_awaitable.hpp +63 -4
  354. data/ext/third_party/asio/asio/include/asio/version.hpp +1 -1
  355. data/ext/third_party/asio/asio/include/asio/windows/basic_object_handle.hpp +4 -4
  356. data/ext/third_party/asio/asio/include/asio/windows/basic_overlapped_handle.hpp +2 -2
  357. data/ext/third_party/asio/asio/include/asio/windows/basic_random_access_handle.hpp +5 -5
  358. data/ext/third_party/asio/asio/include/asio/windows/basic_stream_handle.hpp +5 -5
  359. data/ext/third_party/asio/asio/include/asio/windows/overlapped_ptr.hpp +4 -2
  360. data/ext/third_party/gsl/CMakeLists.txt +13 -5
  361. data/ext/third_party/gsl/include/gsl/gsl_assert +1 -1
  362. data/ext/third_party/gsl/include/gsl/gsl_byte +3 -3
  363. data/ext/third_party/gsl/include/gsl/gsl_narrow +52 -0
  364. data/ext/third_party/gsl/include/gsl/gsl_util +8 -50
  365. data/ext/third_party/gsl/include/gsl/multi_span +0 -10
  366. data/ext/third_party/gsl/include/gsl/pointers +14 -28
  367. data/ext/third_party/gsl/include/gsl/span +98 -46
  368. data/ext/third_party/gsl/include/gsl/string_span +37 -47
  369. data/ext/third_party/http_parser/http_parser.c +17 -10
  370. data/ext/third_party/http_parser/http_parser.h +4 -2
  371. data/ext/third_party/json/include/tao/json/basic_value.hpp +3 -2
  372. data/ext/third_party/json/include/tao/json/binary.hpp +4 -4
  373. data/ext/third_party/json/include/tao/json/binary_view.hpp +2 -2
  374. data/ext/third_party/json/include/tao/json/binding.hpp +2 -2
  375. data/ext/third_party/json/include/tao/json/binding/factory.hpp +8 -7
  376. data/ext/third_party/json/include/tao/json/binding/internal/array.hpp +2 -1
  377. data/ext/third_party/json/include/tao/json/binding/internal/object.hpp +6 -5
  378. data/ext/third_party/json/include/tao/json/binding/versions.hpp +3 -1
  379. data/ext/third_party/json/include/tao/json/cbor.hpp +1 -0
  380. data/ext/third_party/json/include/tao/json/cbor/consume_file.hpp +7 -7
  381. data/ext/third_party/json/include/tao/json/cbor/events/from_binary.hpp +43 -0
  382. data/ext/third_party/json/include/tao/json/cbor/events/from_file.hpp +4 -4
  383. data/ext/third_party/json/include/tao/json/cbor/events/from_string.hpp +3 -3
  384. data/ext/third_party/json/include/tao/json/cbor/from_binary.hpp +32 -0
  385. data/ext/third_party/json/include/tao/json/cbor/from_file.hpp +5 -5
  386. data/ext/third_party/json/include/tao/json/cbor/internal/grammar.hpp +2 -1
  387. data/ext/third_party/json/include/tao/json/consume_file.hpp +7 -7
  388. data/ext/third_party/json/include/tao/json/contrib/internal/indirect_traits.hpp +13 -6
  389. data/ext/third_party/json/include/tao/json/contrib/position.hpp +15 -15
  390. data/ext/third_party/json/include/tao/json/contrib/reference.hpp +5 -7
  391. data/ext/third_party/json/include/tao/json/contrib/schema.hpp +58 -35
  392. data/ext/third_party/json/include/tao/json/contrib/shared_ptr_traits.hpp +12 -4
  393. data/ext/third_party/json/include/tao/json/contrib/unique_ptr_traits.hpp +12 -4
  394. data/ext/third_party/json/include/tao/json/contrib/unordered_map_traits.hpp +1 -1
  395. data/ext/third_party/json/include/tao/json/contrib/unordered_set_traits.hpp +2 -2
  396. data/ext/third_party/json/include/tao/json/events/compare.hpp +2 -12
  397. data/ext/third_party/json/include/tao/json/events/from_file.hpp +4 -4
  398. data/ext/third_party/json/include/tao/json/events/from_string.hpp +2 -2
  399. data/ext/third_party/json/include/tao/json/events/invalid_string_to_binary.hpp +1 -1
  400. data/ext/third_party/json/include/tao/json/events/key_camel_case_to_snake_case.hpp +3 -3
  401. data/ext/third_party/json/include/tao/json/events/key_snake_case_to_camel_case.hpp +1 -1
  402. data/ext/third_party/json/include/tao/json/events/tee.hpp +2 -2
  403. data/ext/third_party/json/include/tao/json/events/to_pretty_stream.hpp +1 -1
  404. data/ext/third_party/json/include/tao/json/events/to_stream.hpp +1 -1
  405. data/ext/third_party/json/include/tao/json/events/transformer.hpp +3 -3
  406. data/ext/third_party/json/include/tao/json/events/validate_event_order.hpp +3 -3
  407. data/ext/third_party/json/include/tao/json/events/virtual_ref.hpp +6 -0
  408. data/ext/third_party/json/include/tao/json/external/pegtl.hpp +4 -13
  409. data/ext/third_party/json/include/tao/json/external/pegtl/argv_input.hpp +3 -5
  410. data/ext/third_party/json/include/tao/json/external/pegtl/ascii.hpp +5 -18
  411. data/ext/third_party/json/include/tao/json/external/pegtl/buffer_input.hpp +3 -3
  412. data/ext/third_party/json/include/tao/json/external/pegtl/change_action.hpp +2 -2
  413. data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_state.hpp +6 -6
  414. data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_states.hpp +5 -5
  415. data/ext/third_party/json/include/tao/json/external/pegtl/change_control.hpp +2 -2
  416. data/ext/third_party/json/include/tao/json/external/pegtl/change_state.hpp +6 -6
  417. data/ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp +5 -5
  418. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/alphabet.hpp +52 -52
  419. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/analyze.hpp +176 -0
  420. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/analyze_traits.hpp +275 -0
  421. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/control_action.hpp +77 -0
  422. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/coverage.hpp +151 -0
  423. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/forward.hpp +16 -0
  424. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/http.hpp +37 -18
  425. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp +20 -22
  426. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf16.hpp +6 -10
  427. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf32.hpp +6 -10
  428. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf8.hpp +2 -4
  429. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/if_then.hpp +11 -10
  430. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/integer.hpp +116 -131
  431. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/endian.hpp +4 -4
  432. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/endian_gcc.hpp +2 -2
  433. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/endian_win.hpp +2 -2
  434. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_mask_uint.hpp +9 -9
  435. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_mask_uint8.hpp +9 -10
  436. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_uint.hpp +9 -9
  437. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_uint8.hpp +9 -10
  438. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_utf16.hpp +10 -10
  439. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/peek_utf32.hpp +9 -9
  440. data/ext/third_party/json/include/tao/json/external/pegtl/{internal → contrib/internal}/read_uint.hpp +3 -3
  441. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/internal/set_stack_guard.hpp +52 -0
  442. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree.hpp +80 -201
  443. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree_to_dot.hpp +11 -10
  444. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/print.hpp +75 -0
  445. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/print_coverage.hpp +53 -0
  446. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/raw_string.hpp +45 -36
  447. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/remove_first_state.hpp +33 -50
  448. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/remove_last_states.hpp +117 -0
  449. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_one_min_max.hpp +43 -11
  450. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_string.hpp +1 -2
  451. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/shuffle_states.hpp +193 -0
  452. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/state_control.hpp +118 -0
  453. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/trace.hpp +227 -0
  454. data/ext/third_party/json/include/tao/json/external/pegtl/{uint16.hpp → contrib/uint16.hpp} +5 -5
  455. data/ext/third_party/json/include/tao/json/external/pegtl/{uint32.hpp → contrib/uint32.hpp} +5 -5
  456. data/ext/third_party/json/include/tao/json/external/pegtl/{uint64.hpp → contrib/uint64.hpp} +5 -5
  457. data/ext/third_party/json/include/tao/json/external/pegtl/{uint8.hpp → contrib/uint8.hpp} +5 -5
  458. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/unescape.hpp +14 -14
  459. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/uri.hpp +1 -1
  460. data/ext/third_party/json/include/tao/json/external/pegtl/{utf16.hpp → contrib/utf16.hpp} +5 -5
  461. data/ext/third_party/json/include/tao/json/external/pegtl/{utf32.hpp → contrib/utf32.hpp} +5 -5
  462. data/ext/third_party/json/include/tao/json/external/pegtl/cstream_input.hpp +2 -3
  463. data/ext/third_party/json/include/tao/json/external/pegtl/{internal/demangle.hpp → demangle.hpp} +12 -14
  464. data/ext/third_party/json/include/tao/json/external/pegtl/disable_action.hpp +2 -2
  465. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input.hpp +2 -2
  466. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_failure.hpp +2 -2
  467. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_success.hpp +2 -2
  468. data/ext/third_party/json/include/tao/json/external/pegtl/enable_action.hpp +2 -2
  469. data/ext/third_party/json/include/tao/json/external/pegtl/file_input.hpp +1 -1
  470. data/ext/third_party/json/include/tao/json/external/pegtl/internal/action.hpp +19 -9
  471. data/ext/third_party/json/include/tao/json/external/pegtl/internal/action_input.hpp +7 -8
  472. data/ext/third_party/json/include/tao/json/external/pegtl/internal/any.hpp +14 -14
  473. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply.hpp +9 -9
  474. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply0.hpp +8 -7
  475. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply_single.hpp +4 -4
  476. data/ext/third_party/json/include/tao/json/external/pegtl/internal/at.hpp +17 -15
  477. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bof.hpp +7 -6
  478. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bol.hpp +8 -8
  479. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump.hpp +4 -4
  480. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump_help.hpp +3 -3
  481. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bytes.hpp +17 -10
  482. data/ext/third_party/json/include/tao/json/external/pegtl/internal/control.hpp +19 -9
  483. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_crlf_eol.hpp +2 -2
  484. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_eol.hpp +2 -2
  485. data/ext/third_party/json/include/tao/json/external/pegtl/internal/crlf_eol.hpp +2 -2
  486. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cstream_reader.hpp +1 -1
  487. data/ext/third_party/json/include/tao/json/external/pegtl/internal/{always_false.hpp → dependent_false.hpp} +3 -8
  488. data/ext/third_party/json/include/tao/json/external/pegtl/internal/disable.hpp +19 -9
  489. data/ext/third_party/json/include/tao/json/external/pegtl/internal/discard.hpp +7 -6
  490. data/ext/third_party/json/include/tao/json/external/pegtl/internal/enable.hpp +19 -9
  491. data/ext/third_party/json/include/tao/json/external/pegtl/internal/{skip_control.hpp → enable_control.hpp} +5 -5
  492. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eof.hpp +7 -6
  493. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eol.hpp +8 -7
  494. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eolf.hpp +8 -7
  495. data/ext/third_party/json/include/tao/json/external/pegtl/internal/failure.hpp +32 -0
  496. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_posix.hpp +61 -10
  497. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_win32.hpp +27 -33
  498. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_reader.hpp +29 -26
  499. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply.hpp +3 -7
  500. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply0.hpp +3 -7
  501. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_match.hpp +4 -20
  502. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_unwind.hpp +21 -0
  503. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_apply.hpp +8 -7
  504. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must.hpp +8 -9
  505. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must_else.hpp +2 -0
  506. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_then_else.hpp +7 -7
  507. data/ext/third_party/json/include/tao/json/external/pegtl/internal/istream_reader.hpp +1 -2
  508. data/ext/third_party/json/include/tao/json/external/pegtl/internal/istring.hpp +11 -11
  509. data/ext/third_party/json/include/tao/json/external/pegtl/internal/iterator.hpp +7 -10
  510. data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_crlf_eol.hpp +2 -2
  511. data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_eol.hpp +2 -2
  512. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail.hpp +4 -2
  513. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail_pad.hpp +1 -1
  514. data/ext/third_party/json/include/tao/json/external/pegtl/internal/marker.hpp +3 -5
  515. data/ext/third_party/json/include/tao/json/external/pegtl/internal/minus.hpp +21 -0
  516. data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply.hpp +5 -2
  517. data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply0.hpp +5 -2
  518. data/ext/third_party/json/include/tao/json/external/pegtl/internal/must.hpp +16 -24
  519. data/ext/third_party/json/include/tao/json/external/pegtl/internal/not_at.hpp +17 -15
  520. data/ext/third_party/json/include/tao/json/external/pegtl/internal/one.hpp +23 -12
  521. data/ext/third_party/json/include/tao/json/external/pegtl/internal/opt.hpp +16 -16
  522. data/ext/third_party/json/include/tao/json/external/pegtl/internal/path_to_string.hpp +26 -0
  523. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_char.hpp +5 -5
  524. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf8.hpp +12 -13
  525. data/ext/third_party/json/include/tao/json/external/pegtl/internal/plus.hpp +18 -11
  526. data/ext/third_party/json/include/tao/json/external/pegtl/internal/raise.hpp +8 -17
  527. data/ext/third_party/json/include/tao/json/external/pegtl/internal/range.hpp +22 -17
  528. data/ext/third_party/json/include/tao/json/external/pegtl/internal/ranges.hpp +28 -18
  529. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rematch.hpp +12 -9
  530. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep.hpp +26 -25
  531. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_min_max.hpp +23 -21
  532. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_opt.hpp +24 -9
  533. data/ext/third_party/json/include/tao/json/external/pegtl/internal/require.hpp +10 -10
  534. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rules.hpp +4 -4
  535. data/ext/third_party/json/include/tao/json/external/pegtl/internal/seq.hpp +18 -33
  536. data/ext/third_party/json/include/tao/json/external/pegtl/internal/sor.hpp +24 -17
  537. data/ext/third_party/json/include/tao/json/external/pegtl/internal/star.hpp +13 -8
  538. data/ext/third_party/json/include/tao/json/external/pegtl/internal/state.hpp +21 -11
  539. data/ext/third_party/json/include/tao/json/external/pegtl/internal/string.hpp +11 -11
  540. data/ext/third_party/json/include/tao/json/external/pegtl/internal/success.hpp +32 -0
  541. data/ext/third_party/json/include/tao/json/external/pegtl/internal/try_catch_type.hpp +16 -16
  542. data/ext/third_party/json/include/tao/json/external/pegtl/internal/until.hpp +18 -14
  543. data/ext/third_party/json/include/tao/json/external/pegtl/istream_input.hpp +2 -3
  544. data/ext/third_party/json/include/tao/json/external/pegtl/match.hpp +125 -29
  545. data/ext/third_party/json/include/tao/json/external/pegtl/memory_input.hpp +32 -48
  546. data/ext/third_party/json/include/tao/json/external/pegtl/mmap_input.hpp +16 -16
  547. data/ext/third_party/json/include/tao/json/external/pegtl/must_if.hpp +64 -0
  548. data/ext/third_party/json/include/tao/json/external/pegtl/normal.hpp +25 -25
  549. data/ext/third_party/json/include/tao/json/external/pegtl/nothing.hpp +1 -2
  550. data/ext/third_party/json/include/tao/json/external/pegtl/parse.hpp +6 -8
  551. data/ext/third_party/json/include/tao/json/external/pegtl/parse_error.hpp +80 -35
  552. data/ext/third_party/json/include/tao/json/external/pegtl/position.hpp +18 -10
  553. data/ext/third_party/json/include/tao/json/external/pegtl/read_input.hpp +18 -38
  554. data/ext/third_party/json/include/tao/json/external/pegtl/rules.hpp +6 -5
  555. data/ext/third_party/json/include/tao/json/external/pegtl/string_input.hpp +3 -5
  556. data/ext/third_party/json/include/tao/json/external/pegtl/type_list.hpp +46 -0
  557. data/ext/third_party/json/include/tao/json/external/pegtl/visit.hpp +66 -0
  558. data/ext/third_party/json/include/tao/json/from_file.hpp +5 -5
  559. data/ext/third_party/json/include/tao/json/internal/action.hpp +3 -3
  560. data/ext/third_party/json/include/tao/json/internal/dependent_false.hpp +14 -0
  561. data/ext/third_party/json/include/tao/json/internal/errors.hpp +17 -17
  562. data/ext/third_party/json/include/tao/json/internal/format.hpp +0 -2
  563. data/ext/third_party/json/include/tao/json/internal/grammar.hpp +17 -17
  564. data/ext/third_party/json/include/tao/json/internal/pair.hpp +1 -1
  565. data/ext/third_party/json/include/tao/json/internal/sha256.hpp +8 -8
  566. data/ext/third_party/json/include/tao/json/internal/single.hpp +1 -1
  567. data/ext/third_party/json/include/tao/json/internal/type_traits.hpp +12 -29
  568. data/ext/third_party/json/include/tao/json/jaxn/consume_file.hpp +7 -7
  569. data/ext/third_party/json/include/tao/json/jaxn/events/from_file.hpp +4 -4
  570. data/ext/third_party/json/include/tao/json/jaxn/events/from_string.hpp +2 -2
  571. data/ext/third_party/json/include/tao/json/jaxn/from_file.hpp +5 -5
  572. data/ext/third_party/json/include/tao/json/jaxn/internal/action.hpp +6 -6
  573. data/ext/third_party/json/include/tao/json/jaxn/internal/bunescape_action.hpp +2 -2
  574. data/ext/third_party/json/include/tao/json/jaxn/internal/errors.hpp +43 -43
  575. data/ext/third_party/json/include/tao/json/jaxn/internal/grammar.hpp +36 -36
  576. data/ext/third_party/json/include/tao/json/jaxn/internal/integer.hpp +10 -11
  577. data/ext/third_party/json/include/tao/json/jaxn/is_identifier.hpp +2 -2
  578. data/ext/third_party/json/include/tao/json/jaxn/parts_parser.hpp +1 -3
  579. data/ext/third_party/json/include/tao/json/message_extension.hpp +2 -2
  580. data/ext/third_party/json/include/tao/json/msgpack.hpp +1 -0
  581. data/ext/third_party/json/include/tao/json/msgpack/consume_file.hpp +7 -7
  582. data/ext/third_party/json/include/tao/json/msgpack/events/from_binary.hpp +43 -0
  583. data/ext/third_party/json/include/tao/json/msgpack/events/from_file.hpp +4 -4
  584. data/ext/third_party/json/include/tao/json/msgpack/events/from_string.hpp +4 -4
  585. data/ext/third_party/json/include/tao/json/msgpack/events/to_stream.hpp +4 -4
  586. data/ext/third_party/json/include/tao/json/msgpack/from_binary.hpp +32 -0
  587. data/ext/third_party/json/include/tao/json/msgpack/from_file.hpp +5 -5
  588. data/ext/third_party/json/include/tao/json/msgpack/internal/grammar.hpp +2 -1
  589. data/ext/third_party/json/include/tao/json/operators.hpp +0 -4
  590. data/ext/third_party/json/include/tao/json/parts_parser.hpp +3 -7
  591. data/ext/third_party/json/include/tao/json/self_contained.hpp +6 -18
  592. data/ext/third_party/json/include/tao/json/span.hpp +94 -166
  593. data/ext/third_party/json/include/tao/json/ubjson.hpp +1 -0
  594. data/ext/third_party/json/include/tao/json/ubjson/consume_file.hpp +7 -7
  595. data/ext/third_party/json/include/tao/json/ubjson/events/from_binary.hpp +43 -0
  596. data/ext/third_party/json/include/tao/json/ubjson/events/from_file.hpp +4 -4
  597. data/ext/third_party/json/include/tao/json/ubjson/events/from_string.hpp +3 -3
  598. data/ext/third_party/json/include/tao/json/ubjson/from_binary.hpp +32 -0
  599. data/ext/third_party/json/include/tao/json/ubjson/from_file.hpp +5 -5
  600. data/ext/third_party/json/include/tao/json/ubjson/internal/grammar.hpp +5 -3
  601. data/ext/third_party/json/include/tao/json/utf8.hpp +1 -1
  602. data/ext/third_party/snappy/snappy.cc +6 -2
  603. data/ext/third_party/spdlog/CMakeLists.txt +24 -57
  604. data/ext/third_party/spdlog/cmake/version.rc.in +1 -1
  605. data/ext/third_party/spdlog/include/spdlog/async.h +3 -3
  606. data/ext/third_party/spdlog/include/spdlog/cfg/argv.h +3 -4
  607. data/ext/third_party/spdlog/include/spdlog/cfg/env.h +6 -4
  608. data/ext/third_party/spdlog/include/spdlog/cfg/helpers-inl.h +22 -6
  609. data/ext/third_party/spdlog/include/spdlog/cfg/helpers.h +3 -2
  610. data/ext/third_party/spdlog/include/spdlog/common.h +1 -2
  611. data/ext/third_party/spdlog/include/spdlog/details/fmt_helper.h +9 -1
  612. data/ext/third_party/spdlog/include/spdlog/details/os.h +1 -1
  613. data/ext/third_party/spdlog/include/spdlog/details/registry-inl.h +21 -7
  614. data/ext/third_party/spdlog/include/spdlog/details/registry.h +6 -3
  615. data/ext/third_party/spdlog/include/spdlog/details/synchronous_factory.h +1 -1
  616. data/ext/third_party/spdlog/include/spdlog/details/tcp_client-windows.h +1 -1
  617. data/ext/third_party/spdlog/include/spdlog/details/tcp_client.h +8 -7
  618. data/ext/third_party/spdlog/include/spdlog/fmt/bin_to_hex.h +2 -2
  619. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/chrono.h +66 -62
  620. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/color.h +35 -37
  621. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/compile.h +173 -103
  622. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/core.h +538 -445
  623. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format-inl.h +114 -64
  624. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format.h +1152 -1071
  625. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/locale.h +16 -16
  626. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/os.h +450 -0
  627. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ostream.h +37 -13
  628. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/posix.h +1 -1
  629. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/printf.h +93 -63
  630. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ranges.h +35 -36
  631. data/ext/third_party/spdlog/include/spdlog/fmt/chrono.h +20 -0
  632. data/ext/third_party/spdlog/include/spdlog/fmt/fmt.h +2 -0
  633. data/ext/third_party/spdlog/include/spdlog/logger-inl.h +5 -1
  634. data/ext/third_party/spdlog/include/spdlog/logger.h +50 -76
  635. data/ext/third_party/spdlog/include/spdlog/pattern_formatter-inl.h +23 -8
  636. data/ext/third_party/spdlog/include/spdlog/pattern_formatter.h +3 -3
  637. data/ext/third_party/spdlog/include/spdlog/sinks/daily_file_sink.h +1 -1
  638. data/ext/third_party/spdlog/include/spdlog/sinks/msvc_sink.h +5 -5
  639. data/ext/third_party/spdlog/include/spdlog/sinks/ringbuffer_sink.h +6 -4
  640. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks-inl.h +32 -3
  641. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks.h +7 -0
  642. data/ext/third_party/spdlog/include/spdlog/sinks/wincolor_sink-inl.h +4 -14
  643. data/ext/third_party/spdlog/include/spdlog/spdlog-inl.h +11 -1
  644. data/ext/third_party/spdlog/include/spdlog/spdlog.h +23 -68
  645. data/ext/third_party/spdlog/include/spdlog/stopwatch.h +61 -0
  646. data/ext/third_party/spdlog/include/spdlog/version.h +2 -2
  647. data/ext/third_party/spdlog/src/fmt.cpp +21 -147
  648. data/lib/couchbase/cluster.rb +111 -1
  649. data/lib/couchbase/collection_options.rb +18 -1
  650. data/lib/couchbase/errors.rb +3 -0
  651. data/lib/couchbase/management/bucket_manager.rb +36 -3
  652. data/lib/couchbase/management/search_index_manager.rb +42 -1
  653. data/lib/couchbase/management/user_manager.rb +155 -48
  654. data/lib/couchbase/query_options.rb +7 -0
  655. data/lib/couchbase/scope.rb +1 -0
  656. data/lib/couchbase/search_options.rb +69 -1
  657. data/lib/couchbase/version.rb +1 -1
  658. metadata +172 -268
  659. data/.rubocop.yml +0 -227
  660. data/.rubocop_todo.yml +0 -47
  661. data/.yardopts +0 -1
  662. data/CONTRIBUTING.md +0 -110
  663. data/Gemfile +0 -37
  664. data/Rakefile +0 -51
  665. data/couchbase.gemspec +0 -79
  666. data/examples/analytics.rb +0 -236
  667. data/examples/auth.rb +0 -33
  668. data/examples/crud.rb +0 -34
  669. data/examples/managing_analytics_indexes.rb +0 -86
  670. data/examples/managing_buckets.rb +0 -61
  671. data/examples/managing_collections.rb +0 -71
  672. data/examples/managing_query_indexes.rb +0 -83
  673. data/examples/managing_search_indexes.rb +0 -77
  674. data/examples/managing_view_indexes.rb +0 -68
  675. data/examples/query.rb +0 -32
  676. data/examples/query_with_consistency.rb +0 -86
  677. data/examples/search.rb +0 -202
  678. data/examples/search_with_consistency.rb +0 -97
  679. data/examples/subdocument.rb +0 -63
  680. data/examples/view.rb +0 -59
  681. data/ext/.clang-format +0 -15
  682. data/ext/.clang-tidy +0 -22
  683. data/ext/.cmake-format.yaml +0 -8
  684. data/ext/.gitignore +0 -2
  685. data/ext/.idea/.name +0 -1
  686. data/ext/.idea/dictionaries/couchbase_terms.xml +0 -14
  687. data/ext/.idea/ext.iml +0 -2
  688. data/ext/.idea/misc.xml +0 -16
  689. data/ext/.idea/modules.xml +0 -8
  690. data/ext/.idea/vcs.xml +0 -12
  691. data/ext/test/main.cxx +0 -184
  692. data/ext/third_party/asio/.appveyor.yml +0 -107
  693. data/ext/third_party/asio/.cirrus.yml +0 -16
  694. data/ext/third_party/asio/.gitignore +0 -3
  695. data/ext/third_party/asio/.travis.yml +0 -323
  696. data/ext/third_party/asio/asio/.gitignore +0 -23
  697. data/ext/third_party/asio/asio/COPYING +0 -4
  698. data/ext/third_party/asio/asio/INSTALL +0 -5
  699. data/ext/third_party/asio/asio/LICENSE_1_0.txt +0 -23
  700. data/ext/third_party/asio/asio/Makefile.am +0 -19
  701. data/ext/third_party/asio/asio/README +0 -4
  702. data/ext/third_party/asio/asio/asio.manifest +0 -4865
  703. data/ext/third_party/asio/asio/autogen.sh +0 -55
  704. data/ext/third_party/asio/asio/boost_asio.manifest +0 -5193
  705. data/ext/third_party/asio/asio/boostify.pl +0 -603
  706. data/ext/third_party/asio/asio/configure.ac +0 -182
  707. data/ext/third_party/asio/asio/include/.gitignore +0 -2
  708. data/ext/third_party/asio/asio/include/Makefile.am +0 -484
  709. data/ext/third_party/asio/asio/include/asio/detail/io_object_executor.hpp +0 -167
  710. data/ext/third_party/asio/asio/include/asio/impl/src.cpp +0 -25
  711. data/ext/third_party/asio/asio/release.pl +0 -440
  712. data/ext/third_party/asio/asio/src/.gitignore +0 -11
  713. data/ext/third_party/asio/asio/src/Makefile.am +0 -23
  714. data/ext/third_party/asio/asio/src/Makefile.mgw +0 -204
  715. data/ext/third_party/asio/asio/src/Makefile.msc +0 -497
  716. data/ext/third_party/asio/asio/src/asio.cpp +0 -11
  717. data/ext/third_party/asio/asio/src/asio_ssl.cpp +0 -11
  718. data/ext/third_party/asio/asio/src/doc/.gitignore +0 -5
  719. data/ext/third_party/asio/asio/src/doc/Jamfile.v2 +0 -62
  720. data/ext/third_party/asio/asio/src/doc/asio.png +0 -0
  721. data/ext/third_party/asio/asio/src/doc/asio.qbk +0 -127
  722. data/ext/third_party/asio/asio/src/doc/asioref.sty +0 -90
  723. data/ext/third_party/asio/asio/src/doc/asioref.xsl +0 -94
  724. data/ext/third_party/asio/asio/src/doc/boost_bind_dox.txt +0 -5
  725. data/ext/third_party/asio/asio/src/doc/doxy2qbk.pl +0 -22
  726. data/ext/third_party/asio/asio/src/doc/examples.qbk +0 -564
  727. data/ext/third_party/asio/asio/src/doc/history.qbk +0 -1794
  728. data/ext/third_party/asio/asio/src/doc/index.xml +0 -13
  729. data/ext/third_party/asio/asio/src/doc/makepdf.pl +0 -26
  730. data/ext/third_party/asio/asio/src/doc/net_ts.qbk +0 -479
  731. data/ext/third_party/asio/asio/src/doc/noncopyable_dox.txt +0 -3
  732. data/ext/third_party/asio/asio/src/doc/overview.qbk +0 -103
  733. data/ext/third_party/asio/asio/src/doc/overview/allocation.qbk +0 -89
  734. data/ext/third_party/asio/asio/src/doc/overview/async.qbk +0 -185
  735. data/ext/third_party/asio/asio/src/doc/overview/async_op1.dot +0 -78
  736. data/ext/third_party/asio/asio/src/doc/overview/async_op1.png +0 -0
  737. data/ext/third_party/asio/asio/src/doc/overview/async_op2.dot +0 -78
  738. data/ext/third_party/asio/asio/src/doc/overview/async_op2.png +0 -0
  739. data/ext/third_party/asio/asio/src/doc/overview/basics.qbk +0 -106
  740. data/ext/third_party/asio/asio/src/doc/overview/bsd_sockets.qbk +0 -270
  741. data/ext/third_party/asio/asio/src/doc/overview/buffers.qbk +0 -163
  742. data/ext/third_party/asio/asio/src/doc/overview/concurrency_hint.qbk +0 -88
  743. data/ext/third_party/asio/asio/src/doc/overview/coroutine.qbk +0 -51
  744. data/ext/third_party/asio/asio/src/doc/overview/coroutines_ts.qbk +0 -97
  745. data/ext/third_party/asio/asio/src/doc/overview/cpp2011.qbk +0 -271
  746. data/ext/third_party/asio/asio/src/doc/overview/handler_tracking.qbk +0 -220
  747. data/ext/third_party/asio/asio/src/doc/overview/implementation.qbk +0 -305
  748. data/ext/third_party/asio/asio/src/doc/overview/iostreams.qbk +0 -72
  749. data/ext/third_party/asio/asio/src/doc/overview/line_based.qbk +0 -118
  750. data/ext/third_party/asio/asio/src/doc/overview/other_protocols.qbk +0 -94
  751. data/ext/third_party/asio/asio/src/doc/overview/posix.qbk +0 -152
  752. data/ext/third_party/asio/asio/src/doc/overview/proactor.dot +0 -100
  753. data/ext/third_party/asio/asio/src/doc/overview/proactor.png +0 -0
  754. data/ext/third_party/asio/asio/src/doc/overview/protocols.qbk +0 -149
  755. data/ext/third_party/asio/asio/src/doc/overview/rationale.qbk +0 -54
  756. data/ext/third_party/asio/asio/src/doc/overview/reactor.qbk +0 -44
  757. data/ext/third_party/asio/asio/src/doc/overview/serial_ports.qbk +0 -45
  758. data/ext/third_party/asio/asio/src/doc/overview/signals.qbk +0 -44
  759. data/ext/third_party/asio/asio/src/doc/overview/spawn.qbk +0 -102
  760. data/ext/third_party/asio/asio/src/doc/overview/ssl.qbk +0 -124
  761. data/ext/third_party/asio/asio/src/doc/overview/strands.qbk +0 -114
  762. data/ext/third_party/asio/asio/src/doc/overview/streams.qbk +0 -62
  763. data/ext/third_party/asio/asio/src/doc/overview/sync_op.dot +0 -67
  764. data/ext/third_party/asio/asio/src/doc/overview/sync_op.png +0 -0
  765. data/ext/third_party/asio/asio/src/doc/overview/threads.qbk +0 -67
  766. data/ext/third_party/asio/asio/src/doc/overview/timers.qbk +0 -52
  767. data/ext/third_party/asio/asio/src/doc/overview/windows.qbk +0 -126
  768. data/ext/third_party/asio/asio/src/doc/project-root.jam +0 -1
  769. data/ext/third_party/asio/asio/src/doc/quickref.xml +0 -561
  770. data/ext/third_party/asio/asio/src/doc/reference.dox +0 -264
  771. data/ext/third_party/asio/asio/src/doc/reference.qbk +0 -125973
  772. data/ext/third_party/asio/asio/src/doc/reference.xsl +0 -1831
  773. data/ext/third_party/asio/asio/src/doc/release_checklist.htm +0 -68
  774. data/ext/third_party/asio/asio/src/doc/requirements/AcceptHandler.qbk +0 -72
  775. data/ext/third_party/asio/asio/src/doc/requirements/AcceptableProtocol.qbk +0 -25
  776. data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessReadDevice.qbk +0 -56
  777. data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessWriteDevice.qbk +0 -57
  778. data/ext/third_party/asio/asio/src/doc/requirements/AsyncReadStream.qbk +0 -50
  779. data/ext/third_party/asio/asio/src/doc/requirements/AsyncWriteStream.qbk +0 -48
  780. data/ext/third_party/asio/asio/src/doc/requirements/BufferedHandshakeHandler.qbk +0 -55
  781. data/ext/third_party/asio/asio/src/doc/requirements/CompletionCondition.qbk +0 -42
  782. data/ext/third_party/asio/asio/src/doc/requirements/CompletionHandler.qbk +0 -63
  783. data/ext/third_party/asio/asio/src/doc/requirements/ConnectCondition.qbk +0 -34
  784. data/ext/third_party/asio/asio/src/doc/requirements/ConnectHandler.qbk +0 -72
  785. data/ext/third_party/asio/asio/src/doc/requirements/ConstBufferSequence.qbk +0 -53
  786. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer.qbk +0 -16
  787. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v1.qbk +0 -93
  788. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v2.qbk +0 -94
  789. data/ext/third_party/asio/asio/src/doc/requirements/Endpoint.qbk +0 -97
  790. data/ext/third_party/asio/asio/src/doc/requirements/EndpointSequence.qbk +0 -30
  791. data/ext/third_party/asio/asio/src/doc/requirements/ExecutionContext.qbk +0 -36
  792. data/ext/third_party/asio/asio/src/doc/requirements/Executor.qbk +0 -141
  793. data/ext/third_party/asio/asio/src/doc/requirements/GettableSerialPortOption.qbk +0 -33
  794. data/ext/third_party/asio/asio/src/doc/requirements/GettableSocketOption.qbk +0 -67
  795. data/ext/third_party/asio/asio/src/doc/requirements/Handler.qbk +0 -64
  796. data/ext/third_party/asio/asio/src/doc/requirements/HandshakeHandler.qbk +0 -72
  797. data/ext/third_party/asio/asio/src/doc/requirements/InternetProtocol.qbk +0 -47
  798. data/ext/third_party/asio/asio/src/doc/requirements/IoControlCommand.qbk +0 -34
  799. data/ext/third_party/asio/asio/src/doc/requirements/IoObjectService.qbk +0 -62
  800. data/ext/third_party/asio/asio/src/doc/requirements/IteratorConnectHandler.qbk +0 -81
  801. data/ext/third_party/asio/asio/src/doc/requirements/LegacyCompletionHandler.qbk +0 -65
  802. data/ext/third_party/asio/asio/src/doc/requirements/MoveAcceptHandler.qbk +0 -61
  803. data/ext/third_party/asio/asio/src/doc/requirements/MutableBufferSequence.qbk +0 -54
  804. data/ext/third_party/asio/asio/src/doc/requirements/ProtoAllocator.qbk +0 -19
  805. data/ext/third_party/asio/asio/src/doc/requirements/Protocol.qbk +0 -56
  806. data/ext/third_party/asio/asio/src/doc/requirements/RangeConnectHandler.qbk +0 -82
  807. data/ext/third_party/asio/asio/src/doc/requirements/ReadHandler.qbk +0 -79
  808. data/ext/third_party/asio/asio/src/doc/requirements/ResolveHandler.qbk +0 -82
  809. data/ext/third_party/asio/asio/src/doc/requirements/Service.qbk +0 -40
  810. data/ext/third_party/asio/asio/src/doc/requirements/SettableSerialPortOption.qbk +0 -33
  811. data/ext/third_party/asio/asio/src/doc/requirements/SettableSocketOption.qbk +0 -54
  812. data/ext/third_party/asio/asio/src/doc/requirements/ShutdownHandler.qbk +0 -72
  813. data/ext/third_party/asio/asio/src/doc/requirements/SignalHandler.qbk +0 -79
  814. data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessReadDevice.qbk +0 -49
  815. data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessWriteDevice.qbk +0 -49
  816. data/ext/third_party/asio/asio/src/doc/requirements/SyncReadStream.qbk +0 -41
  817. data/ext/third_party/asio/asio/src/doc/requirements/SyncWriteStream.qbk +0 -39
  818. data/ext/third_party/asio/asio/src/doc/requirements/TimeTraits.qbk +0 -72
  819. data/ext/third_party/asio/asio/src/doc/requirements/WaitHandler.qbk +0 -72
  820. data/ext/third_party/asio/asio/src/doc/requirements/WaitTraits.qbk +0 -52
  821. data/ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk +0 -79
  822. data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_operations.qbk +0 -300
  823. data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_socket_operations.qbk +0 -39
  824. data/ext/third_party/asio/asio/src/doc/requirements/read_write_operations.qbk +0 -34
  825. data/ext/third_party/asio/asio/src/doc/requirements/synchronous_socket_operations.qbk +0 -37
  826. data/ext/third_party/asio/asio/src/doc/std_exception_dox.txt +0 -7
  827. data/ext/third_party/asio/asio/src/doc/tutorial.dox +0 -226
  828. data/ext/third_party/asio/asio/src/doc/tutorial.qbk +0 -2387
  829. data/ext/third_party/asio/asio/src/doc/tutorial.xsl +0 -437
  830. data/ext/third_party/asio/asio/src/doc/using.qbk +0 -309
  831. data/ext/third_party/asio/asio/tsify.pl +0 -574
  832. data/ext/third_party/gsl/.clang-format +0 -34
  833. data/ext/third_party/gsl/.github/workflows/main.yml +0 -94
  834. data/ext/third_party/gsl/.gitignore +0 -16
  835. data/ext/third_party/gsl/.travis.yml +0 -551
  836. data/ext/third_party/gsl/CMakeSettings.json +0 -18
  837. data/ext/third_party/gsl/CONTRIBUTING.md +0 -29
  838. data/ext/third_party/gsl/GSL.natvis +0 -98
  839. data/ext/third_party/gsl/README.md +0 -124
  840. data/ext/third_party/gsl/appveyor.yml +0 -128
  841. data/ext/third_party/http_parser/.gitignore +0 -30
  842. data/ext/third_party/http_parser/.mailmap +0 -8
  843. data/ext/third_party/http_parser/.travis.yml +0 -13
  844. data/ext/third_party/http_parser/AUTHORS +0 -68
  845. data/ext/third_party/http_parser/Makefile +0 -160
  846. data/ext/third_party/http_parser/README.md +0 -246
  847. data/ext/third_party/http_parser/bench.c +0 -128
  848. data/ext/third_party/http_parser/http_parser.gyp +0 -111
  849. data/ext/third_party/http_parser/test.c +0 -4600
  850. data/ext/third_party/json/.appveyor.yml +0 -44
  851. data/ext/third_party/json/.clang-format +0 -84
  852. data/ext/third_party/json/.conan/build.py +0 -80
  853. data/ext/third_party/json/.conan/test_package/CMakeLists.txt +0 -12
  854. data/ext/third_party/json/.conan/test_package/conanfile.py +0 -24
  855. data/ext/third_party/json/.conan/test_package/test_package.cpp +0 -16
  856. data/ext/third_party/json/.gitignore +0 -3
  857. data/ext/third_party/json/.travis.yml +0 -173
  858. data/ext/third_party/json/Makefile +0 -77
  859. data/ext/third_party/json/README.md +0 -149
  860. data/ext/third_party/json/conanfile.py +0 -28
  861. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/analyze_cycles.hpp +0 -127
  862. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/counted.hpp +0 -23
  863. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/generic.hpp +0 -31
  864. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/grammar_info.hpp +0 -32
  865. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_guard.hpp +0 -51
  866. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_rules.hpp +0 -25
  867. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_info.hpp +0 -29
  868. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_type.hpp +0 -21
  869. data/ext/third_party/json/include/tao/json/external/pegtl/analyze.hpp +0 -21
  870. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/counter.hpp +0 -54
  871. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/tracer.hpp +0 -158
  872. data/ext/third_party/json/include/tao/json/external/pegtl/internal/alnum.hpp +0 -18
  873. data/ext/third_party/json/include/tao/json/external/pegtl/internal/alpha.hpp +0 -18
  874. data/ext/third_party/json/include/tao/json/external/pegtl/internal/dusel_mode.hpp +0 -23
  875. data/ext/third_party/json/include/tao/json/external/pegtl/internal/duseltronik.hpp +0 -187
  876. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_opener.hpp +0 -72
  877. data/ext/third_party/json/include/tao/json/external/pegtl/internal/trivial.hpp +0 -32
  878. data/ext/third_party/snappy/.appveyor.yml +0 -36
  879. data/ext/third_party/snappy/.gitignore +0 -8
  880. data/ext/third_party/snappy/.travis.yml +0 -98
  881. data/ext/third_party/snappy/AUTHORS +0 -1
  882. data/ext/third_party/snappy/CONTRIBUTING.md +0 -26
  883. data/ext/third_party/snappy/NEWS +0 -188
  884. data/ext/third_party/snappy/README.md +0 -148
  885. data/ext/third_party/snappy/docs/README.md +0 -72
  886. data/ext/third_party/snappy/format_description.txt +0 -110
  887. data/ext/third_party/snappy/framing_format.txt +0 -135
  888. data/ext/third_party/snappy/snappy-test.cc +0 -613
  889. data/ext/third_party/snappy/snappy-test.h +0 -526
  890. data/ext/third_party/snappy/snappy_compress_fuzzer.cc +0 -60
  891. data/ext/third_party/snappy/snappy_uncompress_fuzzer.cc +0 -58
  892. data/ext/third_party/snappy/snappy_unittest.cc +0 -1512
  893. data/ext/third_party/spdlog/.clang-format +0 -108
  894. data/ext/third_party/spdlog/.clang-tidy +0 -54
  895. data/ext/third_party/spdlog/.gitattributes +0 -1
  896. data/ext/third_party/spdlog/.gitignore +0 -83
  897. data/ext/third_party/spdlog/.travis.yml +0 -112
  898. data/ext/third_party/spdlog/INSTALL +0 -24
  899. data/ext/third_party/spdlog/README.md +0 -423
  900. data/ext/third_party/spdlog/appveyor.yml +0 -51
  901. data/ext/third_party/spdlog/include/spdlog/cfg/log_levels.h +0 -47
@@ -73,11 +73,12 @@ struct handler_tracking::tracking_state
73
73
  static_mutex mutex_;
74
74
  uint64_t next_id_;
75
75
  tss_ptr<completion>* current_completion_;
76
+ tss_ptr<location>* current_location_;
76
77
  };
77
78
 
78
79
  handler_tracking::tracking_state* handler_tracking::get_state()
79
80
  {
80
- static tracking_state state = { ASIO_STATIC_MUTEX_INIT, 1, 0 };
81
+ static tracking_state state = { ASIO_STATIC_MUTEX_INIT, 1, 0, 0 };
81
82
  return &state;
82
83
  }
83
84
 
@@ -90,6 +91,25 @@ void handler_tracking::init()
90
91
  static_mutex::scoped_lock lock(state->mutex_);
91
92
  if (state->current_completion_ == 0)
92
93
  state->current_completion_ = new tss_ptr<completion>;
94
+ if (state->current_location_ == 0)
95
+ state->current_location_ = new tss_ptr<location>;
96
+ }
97
+
98
+ handler_tracking::location::location(
99
+ const char* file, int line, const char* func)
100
+ : file_(file),
101
+ line_(line),
102
+ func_(func),
103
+ next_(*get_state()->current_location_)
104
+ {
105
+ if (file_)
106
+ *get_state()->current_location_ = this;
107
+ }
108
+
109
+ handler_tracking::location::~location()
110
+ {
111
+ if (file_)
112
+ *get_state()->current_location_ = next_;
93
113
  }
94
114
 
95
115
  void handler_tracking::creation(execution_context&,
@@ -109,6 +129,24 @@ void handler_tracking::creation(execution_context&,
109
129
  if (completion* current_completion = *state->current_completion_)
110
130
  current_id = current_completion->id_;
111
131
 
132
+ for (location* current_location = *state->current_location_;
133
+ current_location; current_location = current_location->next_)
134
+ {
135
+ write_line(
136
+ #if defined(ASIO_WINDOWS)
137
+ "@asio|%I64u.%06I64u|%I64u^%I64u|%s%s%.80s%s(%.80s:%d)\n",
138
+ #else // defined(ASIO_WINDOWS)
139
+ "@asio|%llu.%06llu|%llu^%llu|%s%s%.80s%s(%.80s:%d)\n",
140
+ #endif // defined(ASIO_WINDOWS)
141
+ timestamp.seconds, timestamp.microseconds,
142
+ current_id, h.id_,
143
+ current_location == *state->current_location_ ? "in " : "called from ",
144
+ current_location->func_ ? "'" : "",
145
+ current_location->func_ ? current_location->func_ : "",
146
+ current_location->func_ ? "' " : "",
147
+ current_location->file_, current_location->line_);
148
+ }
149
+
112
150
  write_line(
113
151
  #if defined(ASIO_WINDOWS)
114
152
  "@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n",
@@ -69,8 +69,8 @@ asio::error_code reactive_serial_port_service::open(
69
69
 
70
70
  // Set up default serial port options.
71
71
  termios ios;
72
- errno = 0;
73
- s = descriptor_ops::error_wrapper(::tcgetattr(fd, &ios), ec);
72
+ s = ::tcgetattr(fd, &ios);
73
+ descriptor_ops::get_last_error(ec, s < 0);
74
74
  if (s >= 0)
75
75
  {
76
76
  #if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE)
@@ -85,8 +85,8 @@ asio::error_code reactive_serial_port_service::open(
85
85
  #endif
86
86
  ios.c_iflag |= IGNPAR;
87
87
  ios.c_cflag |= CREAD | CLOCAL;
88
- errno = 0;
89
- s = descriptor_ops::error_wrapper(::tcsetattr(fd, TCSANOW, &ios), ec);
88
+ s = ::tcsetattr(fd, TCSANOW, &ios);
89
+ descriptor_ops::get_last_error(ec, s < 0);
90
90
  }
91
91
  if (s < 0)
92
92
  {
@@ -111,18 +111,16 @@ asio::error_code reactive_serial_port_service::do_set_option(
111
111
  const void* option, asio::error_code& ec)
112
112
  {
113
113
  termios ios;
114
- errno = 0;
115
- descriptor_ops::error_wrapper(::tcgetattr(
116
- descriptor_service_.native_handle(impl), &ios), ec);
117
- if (ec)
114
+ int s = ::tcgetattr(descriptor_service_.native_handle(impl), &ios);
115
+ descriptor_ops::get_last_error(ec, s < 0);
116
+ if (s < 0)
118
117
  return ec;
119
118
 
120
119
  if (store(option, ios, ec))
121
120
  return ec;
122
121
 
123
- errno = 0;
124
- descriptor_ops::error_wrapper(::tcsetattr(
125
- descriptor_service_.native_handle(impl), TCSANOW, &ios), ec);
122
+ s = ::tcsetattr(descriptor_service_.native_handle(impl), TCSANOW, &ios);
123
+ descriptor_ops::get_last_error(ec, s < 0);
126
124
  return ec;
127
125
  }
128
126
 
@@ -132,10 +130,9 @@ asio::error_code reactive_serial_port_service::do_get_option(
132
130
  void* option, asio::error_code& ec) const
133
131
  {
134
132
  termios ios;
135
- errno = 0;
136
- descriptor_ops::error_wrapper(::tcgetattr(
137
- descriptor_service_.native_handle(impl), &ios), ec);
138
- if (ec)
133
+ int s = ::tcgetattr(descriptor_service_.native_handle(impl), &ios);
134
+ descriptor_ops::get_last_error(ec, s < 0);
135
+ if (s < 0)
139
136
  return ec;
140
137
 
141
138
  return load(option, ios, ec);
@@ -135,6 +135,10 @@ scheduler::~scheduler()
135
135
  {
136
136
  if (thread_)
137
137
  {
138
+ mutex::scoped_lock lock(mutex_);
139
+ shutdown_ = true;
140
+ stop_all_threads(lock);
141
+ lock.unlock();
138
142
  thread_->join();
139
143
  delete thread_;
140
144
  }
@@ -320,6 +324,12 @@ void scheduler::compensating_work_started()
320
324
  ++static_cast<thread_info*>(this_thread)->private_outstanding_work;
321
325
  }
322
326
 
327
+ void scheduler::capture_current_exception()
328
+ {
329
+ if (thread_info_base* this_thread = thread_call_stack::contains(this))
330
+ this_thread->capture_current_exception();
331
+ }
332
+
323
333
  void scheduler::post_immediate_completion(
324
334
  scheduler::operation* op, bool is_continuation)
325
335
  {
@@ -343,6 +353,30 @@ void scheduler::post_immediate_completion(
343
353
  wake_one_thread_and_unlock(lock);
344
354
  }
345
355
 
356
+ void scheduler::post_immediate_completions(std::size_t n,
357
+ op_queue<scheduler::operation>& ops, bool is_continuation)
358
+ {
359
+ #if defined(ASIO_HAS_THREADS)
360
+ if (one_thread_ || is_continuation)
361
+ {
362
+ if (thread_info_base* this_thread = thread_call_stack::contains(this))
363
+ {
364
+ static_cast<thread_info*>(this_thread)->private_outstanding_work
365
+ += static_cast<long>(n);
366
+ static_cast<thread_info*>(this_thread)->private_op_queue.push(ops);
367
+ return;
368
+ }
369
+ }
370
+ #else // defined(ASIO_HAS_THREADS)
371
+ (void)is_continuation;
372
+ #endif // defined(ASIO_HAS_THREADS)
373
+
374
+ increment(outstanding_work_, static_cast<long>(n));
375
+ mutex::scoped_lock lock(mutex_);
376
+ op_queue_.push(ops);
377
+ wake_one_thread_and_unlock(lock);
378
+ }
379
+
346
380
  void scheduler::post_deferred_completion(scheduler::operation* op)
347
381
  {
348
382
  #if defined(ASIO_HAS_THREADS)
@@ -444,6 +478,7 @@ std::size_t scheduler::do_run_one(mutex::scoped_lock& lock,
444
478
 
445
479
  // Complete the operation. May throw an exception. Deletes the object.
446
480
  o->complete(this, ec, task_result);
481
+ this_thread.rethrow_pending_exception();
447
482
 
448
483
  return 1;
449
484
  }
@@ -524,6 +559,7 @@ std::size_t scheduler::do_wait_one(mutex::scoped_lock& lock,
524
559
 
525
560
  // Complete the operation. May throw an exception. Deletes the object.
526
561
  o->complete(this, ec, task_result);
562
+ this_thread.rethrow_pending_exception();
527
563
 
528
564
  return 1;
529
565
  }
@@ -578,6 +614,7 @@ std::size_t scheduler::do_poll_one(mutex::scoped_lock& lock,
578
614
 
579
615
  // Complete the operation. May throw an exception. Deletes the object.
580
616
  o->complete(this, ec, task_result);
617
+ this_thread.rethrow_pending_exception();
581
618
 
582
619
  return 1;
583
620
  }
@@ -89,7 +89,8 @@ class signal_set_service::pipe_read_op : public reactor_op
89
89
  {
90
90
  public:
91
91
  pipe_read_op()
92
- : reactor_op(&pipe_read_op::do_perform, pipe_read_op::do_complete)
92
+ : reactor_op(asio::error_code(),
93
+ &pipe_read_op::do_perform, pipe_read_op::do_complete)
93
94
  {
94
95
  }
95
96
 
@@ -73,18 +73,23 @@ inline void clear_last_error()
73
73
 
74
74
  #if !defined(ASIO_WINDOWS_RUNTIME)
75
75
 
76
- template <typename ReturnType>
77
- inline ReturnType error_wrapper(ReturnType return_value,
78
- asio::error_code& ec)
76
+ inline void get_last_error(
77
+ asio::error_code& ec, bool is_error_condition)
79
78
  {
79
+ if (!is_error_condition)
80
+ {
81
+ ec.assign(0, ec.category());
82
+ }
83
+ else
84
+ {
80
85
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
81
- ec = asio::error_code(WSAGetLastError(),
82
- asio::error::get_system_category());
86
+ ec = asio::error_code(WSAGetLastError(),
87
+ asio::error::get_system_category());
83
88
  #else
84
- ec = asio::error_code(errno,
85
- asio::error::get_system_category());
89
+ ec = asio::error_code(errno,
90
+ asio::error::get_system_category());
86
91
  #endif
87
- return return_value;
92
+ }
88
93
  }
89
94
 
90
95
  template <typename SockLenType>
@@ -107,17 +112,16 @@ socket_type accept(socket_type s, socket_addr_type* addr,
107
112
  return invalid_socket;
108
113
  }
109
114
 
110
- clear_last_error();
111
-
112
- socket_type new_s = error_wrapper(call_accept(
113
- &msghdr::msg_namelen, s, addr, addrlen), ec);
115
+ socket_type new_s = call_accept(&msghdr::msg_namelen, s, addr, addrlen);
116
+ get_last_error(ec, new_s == invalid_socket);
114
117
  if (new_s == invalid_socket)
115
118
  return new_s;
116
119
 
117
120
  #if defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__)
118
121
  int optval = 1;
119
- int result = error_wrapper(::setsockopt(new_s,
120
- SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval)), ec);
122
+ int result = ::setsockopt(new_s, SOL_SOCKET,
123
+ SO_NOSIGPIPE, &optval, sizeof(optval));
124
+ get_last_error(ec, result != 0);
121
125
  if (result != 0)
122
126
  {
123
127
  ::close(new_s);
@@ -125,7 +129,7 @@ socket_type accept(socket_type s, socket_addr_type* addr,
125
129
  }
126
130
  #endif
127
131
 
128
- ec = asio::error_code();
132
+ ec.assign(0, ec.category());
129
133
  return new_s;
130
134
  }
131
135
 
@@ -282,11 +286,8 @@ int bind(socket_type s, const socket_addr_type* addr,
282
286
  return socket_error_retval;
283
287
  }
284
288
 
285
- clear_last_error();
286
- int result = error_wrapper(call_bind(
287
- &msghdr::msg_namelen, s, addr, addrlen), ec);
288
- if (result == 0)
289
- ec = asio::error_code();
289
+ int result = call_bind(&msghdr::msg_namelen, s, addr, addrlen);
290
+ get_last_error(ec, result != 0);
290
291
  return result;
291
292
  }
292
293
 
@@ -309,12 +310,12 @@ int close(socket_type s, state_type& state,
309
310
  SO_LINGER, &opt, sizeof(opt), ignored_ec);
310
311
  }
311
312
 
312
- clear_last_error();
313
313
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
314
- result = error_wrapper(::closesocket(s), ec);
314
+ result = ::closesocket(s);
315
315
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
316
- result = error_wrapper(::close(s), ec);
316
+ result = ::close(s);
317
317
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
318
+ get_last_error(ec, result != 0);
318
319
 
319
320
  if (result != 0
320
321
  && (ec == asio::error::would_block
@@ -341,17 +342,15 @@ int close(socket_type s, state_type& state,
341
342
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
342
343
  state &= ~non_blocking;
343
344
 
344
- clear_last_error();
345
345
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
346
- result = error_wrapper(::closesocket(s), ec);
346
+ result = ::closesocket(s);
347
347
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
348
- result = error_wrapper(::close(s), ec);
348
+ result = ::close(s);
349
349
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
350
+ get_last_error(ec, result != 0);
350
351
  }
351
352
  }
352
353
 
353
- if (result == 0)
354
- ec = asio::error_code();
355
354
  return result;
356
355
  }
357
356
 
@@ -364,26 +363,27 @@ bool set_user_non_blocking(socket_type s,
364
363
  return false;
365
364
  }
366
365
 
367
- clear_last_error();
368
366
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
369
367
  ioctl_arg_type arg = (value ? 1 : 0);
370
- int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec);
368
+ int result = ::ioctlsocket(s, FIONBIO, &arg);
369
+ get_last_error(ec, result < 0);
371
370
  #elif defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__)
372
- int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec);
371
+ int result = ::fcntl(s, F_GETFL, 0);
372
+ get_last_error(ec, result < 0);
373
373
  if (result >= 0)
374
374
  {
375
- clear_last_error();
376
375
  int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
377
- result = error_wrapper(::fcntl(s, F_SETFL, flag), ec);
376
+ result = ::fcntl(s, F_SETFL, flag);
377
+ get_last_error(ec, result < 0);
378
378
  }
379
379
  #else
380
380
  ioctl_arg_type arg = (value ? 1 : 0);
381
- int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec);
381
+ int result = ::ioctl(s, FIONBIO, &arg);
382
+ get_last_error(ec, result < 0);
382
383
  #endif
383
384
 
384
385
  if (result >= 0)
385
386
  {
386
- ec = asio::error_code();
387
387
  if (value)
388
388
  state |= user_set_non_blocking;
389
389
  else
@@ -417,26 +417,27 @@ bool set_internal_non_blocking(socket_type s,
417
417
  return false;
418
418
  }
419
419
 
420
- clear_last_error();
421
420
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
422
421
  ioctl_arg_type arg = (value ? 1 : 0);
423
- int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec);
422
+ int result = ::ioctlsocket(s, FIONBIO, &arg);
423
+ get_last_error(ec, result < 0);
424
424
  #elif defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__)
425
- int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec);
425
+ int result = ::fcntl(s, F_GETFL, 0);
426
+ get_last_error(ec, result < 0);
426
427
  if (result >= 0)
427
428
  {
428
- clear_last_error();
429
429
  int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
430
- result = error_wrapper(::fcntl(s, F_SETFL, flag), ec);
430
+ result = ::fcntl(s, F_SETFL, flag);
431
+ get_last_error(ec, result < 0);
431
432
  }
432
433
  #else
433
434
  ioctl_arg_type arg = (value ? 1 : 0);
434
- int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec);
435
+ int result = ::ioctl(s, FIONBIO, &arg);
436
+ get_last_error(ec, result < 0);
435
437
  #endif
436
438
 
437
439
  if (result >= 0)
438
440
  {
439
- ec = asio::error_code();
440
441
  if (value)
441
442
  state |= internal_non_blocking;
442
443
  else
@@ -455,10 +456,8 @@ int shutdown(socket_type s, int what, asio::error_code& ec)
455
456
  return socket_error_retval;
456
457
  }
457
458
 
458
- clear_last_error();
459
- int result = error_wrapper(::shutdown(s, what), ec);
460
- if (result == 0)
461
- ec = asio::error_code();
459
+ int result = ::shutdown(s, what);
460
+ get_last_error(ec, result != 0);
462
461
  return result;
463
462
  }
464
463
 
@@ -478,13 +477,10 @@ int connect(socket_type s, const socket_addr_type* addr,
478
477
  return socket_error_retval;
479
478
  }
480
479
 
481
- clear_last_error();
482
- int result = error_wrapper(call_connect(
483
- &msghdr::msg_namelen, s, addr, addrlen), ec);
484
- if (result == 0)
485
- ec = asio::error_code();
480
+ int result = call_connect(&msghdr::msg_namelen, s, addr, addrlen);
481
+ get_last_error(ec, result != 0);
486
482
  #if defined(__linux__)
487
- else if (ec == asio::error::try_again)
483
+ if (result != 0 && ec == asio::error::try_again)
488
484
  ec = asio::error::no_buffer_space;
489
485
  #endif // defined(__linux__)
490
486
  return result;
@@ -600,7 +596,7 @@ bool non_blocking_connect(socket_type s, asio::error_code& ec)
600
596
  asio::error::get_system_category());
601
597
  }
602
598
  else
603
- ec = asio::error_code();
599
+ ec.assign(0, ec.category());
604
600
  }
605
601
 
606
602
  return true;
@@ -617,10 +613,8 @@ int socketpair(int af, int type, int protocol,
617
613
  ec = asio::error::operation_not_supported;
618
614
  return socket_error_retval;
619
615
  #else
620
- clear_last_error();
621
- int result = error_wrapper(::socketpair(af, type, protocol, sv), ec);
622
- if (result == 0)
623
- ec = asio::error_code();
616
+ int result = ::socketpair(af, type, protocol, sv);
617
+ get_last_error(ec, result != 0);
624
618
  return result;
625
619
  #endif
626
620
  }
@@ -636,20 +630,18 @@ bool sockatmark(socket_type s, asio::error_code& ec)
636
630
  #if defined(SIOCATMARK)
637
631
  ioctl_arg_type value = 0;
638
632
  # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
639
- int result = error_wrapper(::ioctlsocket(s, SIOCATMARK, &value), ec);
633
+ int result = ::ioctlsocket(s, SIOCATMARK, &value);
640
634
  # else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
641
- int result = error_wrapper(::ioctl(s, SIOCATMARK, &value), ec);
635
+ int result = ::ioctl(s, SIOCATMARK, &value);
642
636
  # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
643
- if (result == 0)
644
- ec = asio::error_code();
637
+ get_last_error(ec, result < 0);
645
638
  # if defined(ENOTTY)
646
639
  if (ec.value() == ENOTTY)
647
640
  ec = asio::error::not_socket;
648
641
  # endif // defined(ENOTTY)
649
642
  #else // defined(SIOCATMARK)
650
- int value = error_wrapper(::sockatmark(s), ec);
651
- if (value != -1)
652
- ec = asio::error_code();
643
+ int value = ::sockatmark(s);
644
+ get_last_error(ec, result < 0);
653
645
  #endif // defined(SIOCATMARK)
654
646
 
655
647
  return ec ? false : value != 0;
@@ -665,12 +657,11 @@ size_t available(socket_type s, asio::error_code& ec)
665
657
 
666
658
  ioctl_arg_type value = 0;
667
659
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
668
- int result = error_wrapper(::ioctlsocket(s, FIONREAD, &value), ec);
660
+ int result = ::ioctlsocket(s, FIONREAD, &value);
669
661
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
670
- int result = error_wrapper(::ioctl(s, FIONREAD, &value), ec);
662
+ int result = ::ioctl(s, FIONREAD, &value);
671
663
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
672
- if (result == 0)
673
- ec = asio::error_code();
664
+ get_last_error(ec, result < 0);
674
665
  #if defined(ENOTTY)
675
666
  if (ec.value() == ENOTTY)
676
667
  ec = asio::error::not_socket;
@@ -687,10 +678,8 @@ int listen(socket_type s, int backlog, asio::error_code& ec)
687
678
  return socket_error_retval;
688
679
  }
689
680
 
690
- clear_last_error();
691
- int result = error_wrapper(::listen(s, backlog), ec);
692
- if (result == 0)
693
- ec = asio::error_code();
681
+ int result = ::listen(s, backlog);
682
+ get_last_error(ec, result != 0);
694
683
  return result;
695
684
  }
696
685
 
@@ -758,14 +747,14 @@ inline void init_msghdr_msg_name(T& name, const socket_addr_type* addr)
758
747
  signed_size_type recv(socket_type s, buf* bufs, size_t count,
759
748
  int flags, asio::error_code& ec)
760
749
  {
761
- clear_last_error();
762
750
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
763
751
  // Receive some data.
764
752
  DWORD recv_buf_count = static_cast<DWORD>(count);
765
753
  DWORD bytes_transferred = 0;
766
754
  DWORD recv_flags = flags;
767
- int result = error_wrapper(::WSARecv(s, bufs,
768
- recv_buf_count, &bytes_transferred, &recv_flags, 0, 0), ec);
755
+ int result = ::WSARecv(s, bufs, recv_buf_count,
756
+ &bytes_transferred, &recv_flags, 0, 0);
757
+ get_last_error(ec, true);
769
758
  if (ec.value() == ERROR_NETNAME_DELETED)
770
759
  ec = asio::error::connection_reset;
771
760
  else if (ec.value() == ERROR_PORT_UNREACHABLE)
@@ -774,15 +763,44 @@ signed_size_type recv(socket_type s, buf* bufs, size_t count,
774
763
  result = 0;
775
764
  if (result != 0)
776
765
  return socket_error_retval;
777
- ec = asio::error_code();
766
+ ec.assign(0, ec.category());
778
767
  return bytes_transferred;
779
768
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
780
769
  msghdr msg = msghdr();
781
770
  msg.msg_iov = bufs;
782
771
  msg.msg_iovlen = static_cast<int>(count);
783
- signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec);
784
- if (result >= 0)
785
- ec = asio::error_code();
772
+ signed_size_type result = ::recvmsg(s, &msg, flags);
773
+ get_last_error(ec, result < 0);
774
+ return result;
775
+ #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
776
+ }
777
+
778
+ signed_size_type recv1(socket_type s, void* data, size_t size,
779
+ int flags, asio::error_code& ec)
780
+ {
781
+ #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
782
+ // Receive some data.
783
+ WSABUF buf;
784
+ buf.buf = const_cast<char*>(static_cast<const char*>(data));
785
+ buf.len = static_cast<ULONG>(size);
786
+ DWORD bytes_transferred = 0;
787
+ DWORD recv_flags = flags;
788
+ int result = ::WSARecv(s, &buf, 1,
789
+ &bytes_transferred, &recv_flags, 0, 0);
790
+ get_last_error(ec, true);
791
+ if (ec.value() == ERROR_NETNAME_DELETED)
792
+ ec = asio::error::connection_reset;
793
+ else if (ec.value() == ERROR_PORT_UNREACHABLE)
794
+ ec = asio::error::connection_refused;
795
+ else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
796
+ result = 0;
797
+ if (result != 0)
798
+ return socket_error_retval;
799
+ ec.assign(0, ec.category());
800
+ return bytes_transferred;
801
+ #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
802
+ signed_size_type result = ::recv(s, static_cast<char*>(data), size, flags);
803
+ get_last_error(ec, result < 0);
786
804
  return result;
787
805
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
788
806
  }
@@ -799,7 +817,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs,
799
817
  // A request to read 0 bytes on a stream is a no-op.
800
818
  if (all_empty && (state & stream_oriented))
801
819
  {
802
- ec = asio::error_code();
820
+ ec.assign(0, ec.category());
803
821
  return 0;
804
822
  }
805
823
 
@@ -809,10 +827,51 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs,
809
827
  // Try to complete the operation without blocking.
810
828
  signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec);
811
829
 
830
+ // Check for EOF.
831
+ if ((state & stream_oriented) && bytes == 0)
832
+ {
833
+ ec = asio::error::eof;
834
+ return 0;
835
+ }
836
+
812
837
  // Check if operation succeeded.
813
- if (bytes > 0)
838
+ if (bytes >= 0)
814
839
  return bytes;
815
840
 
841
+ // Operation failed.
842
+ if ((state & user_set_non_blocking)
843
+ || (ec != asio::error::would_block
844
+ && ec != asio::error::try_again))
845
+ return 0;
846
+
847
+ // Wait for socket to become ready.
848
+ if (socket_ops::poll_read(s, 0, -1, ec) < 0)
849
+ return 0;
850
+ }
851
+ }
852
+
853
+ size_t sync_recv1(socket_type s, state_type state, void* data,
854
+ size_t size, int flags, asio::error_code& ec)
855
+ {
856
+ if (s == invalid_socket)
857
+ {
858
+ ec = asio::error::bad_descriptor;
859
+ return 0;
860
+ }
861
+
862
+ // A request to read 0 bytes on a stream is a no-op.
863
+ if (size == 0 && (state & stream_oriented))
864
+ {
865
+ ec.assign(0, ec.category());
866
+ return 0;
867
+ }
868
+
869
+ // Read some data.
870
+ for (;;)
871
+ {
872
+ // Try to complete the operation without blocking.
873
+ signed_size_type bytes = socket_ops::recv1(s, data, size, flags, ec);
874
+
816
875
  // Check for EOF.
817
876
  if ((state & stream_oriented) && bytes == 0)
818
877
  {
@@ -820,6 +879,10 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs,
820
879
  return 0;
821
880
  }
822
881
 
882
+ // Check if operation succeeded.
883
+ if (bytes >= 0)
884
+ return bytes;
885
+
823
886
  // Operation failed.
824
887
  if ((state & user_set_non_blocking)
825
888
  || (ec != asio::error::would_block
@@ -882,6 +945,13 @@ bool non_blocking_recv(socket_type s,
882
945
  return true;
883
946
  }
884
947
 
948
+ // Check if operation succeeded.
949
+ if (bytes >= 0)
950
+ {
951
+ bytes_transferred = bytes;
952
+ return true;
953
+ }
954
+
885
955
  // Retry operation if interrupted by signal.
886
956
  if (ec == asio::error::interrupted)
887
957
  continue;
@@ -891,15 +961,46 @@ bool non_blocking_recv(socket_type s,
891
961
  || ec == asio::error::try_again)
892
962
  return false;
893
963
 
894
- // Operation is complete.
964
+ // Operation failed.
965
+ bytes_transferred = 0;
966
+ return true;
967
+ }
968
+ }
969
+
970
+ bool non_blocking_recv1(socket_type s,
971
+ void* data, size_t size, int flags, bool is_stream,
972
+ asio::error_code& ec, size_t& bytes_transferred)
973
+ {
974
+ for (;;)
975
+ {
976
+ // Read some data.
977
+ signed_size_type bytes = socket_ops::recv1(s, data, size, flags, ec);
978
+
979
+ // Check for end of stream.
980
+ if (is_stream && bytes == 0)
981
+ {
982
+ ec = asio::error::eof;
983
+ return true;
984
+ }
985
+
986
+ // Check if operation succeeded.
895
987
  if (bytes >= 0)
896
988
  {
897
- ec = asio::error_code();
898
989
  bytes_transferred = bytes;
990
+ return true;
899
991
  }
900
- else
901
- bytes_transferred = 0;
902
992
 
993
+ // Retry operation if interrupted by signal.
994
+ if (ec == asio::error::interrupted)
995
+ continue;
996
+
997
+ // Check if we need to run the operation again.
998
+ if (ec == asio::error::would_block
999
+ || ec == asio::error::try_again)
1000
+ return false;
1001
+
1002
+ // Operation failed.
1003
+ bytes_transferred = 0;
903
1004
  return true;
904
1005
  }
905
1006
  }
@@ -910,15 +1011,15 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
910
1011
  int flags, socket_addr_type* addr, std::size_t* addrlen,
911
1012
  asio::error_code& ec)
912
1013
  {
913
- clear_last_error();
914
1014
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
915
1015
  // Receive some data.
916
1016
  DWORD recv_buf_count = static_cast<DWORD>(count);
917
1017
  DWORD bytes_transferred = 0;
918
1018
  DWORD recv_flags = flags;
919
1019
  int tmp_addrlen = (int)*addrlen;
920
- int result = error_wrapper(::WSARecvFrom(s, bufs, recv_buf_count,
921
- &bytes_transferred, &recv_flags, addr, &tmp_addrlen, 0, 0), ec);
1020
+ int result = ::WSARecvFrom(s, bufs, recv_buf_count,
1021
+ &bytes_transferred, &recv_flags, addr, &tmp_addrlen, 0, 0);
1022
+ get_last_error(ec, true);
922
1023
  *addrlen = (std::size_t)tmp_addrlen;
923
1024
  if (ec.value() == ERROR_NETNAME_DELETED)
924
1025
  ec = asio::error::connection_reset;
@@ -928,7 +1029,7 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
928
1029
  result = 0;
929
1030
  if (result != 0)
930
1031
  return socket_error_retval;
931
- ec = asio::error_code();
1032
+ ec.assign(0, ec.category());
932
1033
  return bytes_transferred;
933
1034
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
934
1035
  msghdr msg = msghdr();
@@ -936,10 +1037,56 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
936
1037
  msg.msg_namelen = static_cast<int>(*addrlen);
937
1038
  msg.msg_iov = bufs;
938
1039
  msg.msg_iovlen = static_cast<int>(count);
939
- signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec);
1040
+ signed_size_type result = ::recvmsg(s, &msg, flags);
1041
+ get_last_error(ec, result < 0);
940
1042
  *addrlen = msg.msg_namelen;
941
- if (result >= 0)
942
- ec = asio::error_code();
1043
+ return result;
1044
+ #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1045
+ }
1046
+
1047
+ template <typename SockLenType>
1048
+ inline signed_size_type call_recvfrom(SockLenType msghdr::*,
1049
+ socket_type s, void* data, size_t size, int flags,
1050
+ socket_addr_type* addr, std::size_t* addrlen)
1051
+ {
1052
+ SockLenType tmp_addrlen = addrlen ? (SockLenType)*addrlen : 0;
1053
+ signed_size_type result = ::recvfrom(s, static_cast<char*>(data),
1054
+ size, flags, addr, addrlen ? &tmp_addrlen : 0);
1055
+ if (addrlen)
1056
+ *addrlen = (std::size_t)tmp_addrlen;
1057
+ return result;
1058
+ }
1059
+
1060
+ signed_size_type recvfrom1(socket_type s, void* data, size_t size,
1061
+ int flags, socket_addr_type* addr, std::size_t* addrlen,
1062
+ asio::error_code& ec)
1063
+ {
1064
+ #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1065
+ // Receive some data.
1066
+ WSABUF buf;
1067
+ buf.buf = static_cast<char*>(data);
1068
+ buf.len = static_cast<ULONG>(size);
1069
+ DWORD bytes_transferred = 0;
1070
+ DWORD recv_flags = flags;
1071
+ int tmp_addrlen = (int)*addrlen;
1072
+ int result = ::WSARecvFrom(s, &buf, 1, &bytes_transferred,
1073
+ &recv_flags, addr, &tmp_addrlen, 0, 0);
1074
+ get_last_error(ec, true);
1075
+ *addrlen = (std::size_t)tmp_addrlen;
1076
+ if (ec.value() == ERROR_NETNAME_DELETED)
1077
+ ec = asio::error::connection_reset;
1078
+ else if (ec.value() == ERROR_PORT_UNREACHABLE)
1079
+ ec = asio::error::connection_refused;
1080
+ else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
1081
+ result = 0;
1082
+ if (result != 0)
1083
+ return socket_error_retval;
1084
+ ec.assign(0, ec.category());
1085
+ return bytes_transferred;
1086
+ #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1087
+ signed_size_type result = call_recvfrom(&msghdr::msg_namelen,
1088
+ s, data, size, flags, addr, addrlen);
1089
+ get_last_error(ec, result < 0);
943
1090
  return result;
944
1091
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
945
1092
  }
@@ -977,6 +1124,39 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs,
977
1124
  }
978
1125
  }
979
1126
 
1127
+ size_t sync_recvfrom1(socket_type s, state_type state, void* data,
1128
+ size_t size, int flags, socket_addr_type* addr,
1129
+ std::size_t* addrlen, asio::error_code& ec)
1130
+ {
1131
+ if (s == invalid_socket)
1132
+ {
1133
+ ec = asio::error::bad_descriptor;
1134
+ return 0;
1135
+ }
1136
+
1137
+ // Read some data.
1138
+ for (;;)
1139
+ {
1140
+ // Try to complete the operation without blocking.
1141
+ signed_size_type bytes = socket_ops::recvfrom1(
1142
+ s, data, size, flags, addr, addrlen, ec);
1143
+
1144
+ // Check if operation succeeded.
1145
+ if (bytes >= 0)
1146
+ return bytes;
1147
+
1148
+ // Operation failed.
1149
+ if ((state & user_set_non_blocking)
1150
+ || (ec != asio::error::would_block
1151
+ && ec != asio::error::try_again))
1152
+ return 0;
1153
+
1154
+ // Wait for socket to become ready.
1155
+ if (socket_ops::poll_read(s, 0, -1, ec) < 0)
1156
+ return 0;
1157
+ }
1158
+ }
1159
+
980
1160
  #if defined(ASIO_HAS_IOCP)
981
1161
 
982
1162
  void complete_iocp_recvfrom(
@@ -1014,6 +1194,13 @@ bool non_blocking_recvfrom(socket_type s,
1014
1194
  signed_size_type bytes = socket_ops::recvfrom(
1015
1195
  s, bufs, count, flags, addr, addrlen, ec);
1016
1196
 
1197
+ // Check if operation succeeded.
1198
+ if (bytes >= 0)
1199
+ {
1200
+ bytes_transferred = bytes;
1201
+ return true;
1202
+ }
1203
+
1017
1204
  // Retry operation if interrupted by signal.
1018
1205
  if (ec == asio::error::interrupted)
1019
1206
  continue;
@@ -1023,15 +1210,41 @@ bool non_blocking_recvfrom(socket_type s,
1023
1210
  || ec == asio::error::try_again)
1024
1211
  return false;
1025
1212
 
1026
- // Operation is complete.
1213
+ // Operation failed.
1214
+ bytes_transferred = 0;
1215
+ return true;
1216
+ }
1217
+ }
1218
+
1219
+ bool non_blocking_recvfrom1(socket_type s,
1220
+ void* data, size_t size, int flags,
1221
+ socket_addr_type* addr, std::size_t* addrlen,
1222
+ asio::error_code& ec, size_t& bytes_transferred)
1223
+ {
1224
+ for (;;)
1225
+ {
1226
+ // Read some data.
1227
+ signed_size_type bytes = socket_ops::recvfrom1(
1228
+ s, data, size, flags, addr, addrlen, ec);
1229
+
1230
+ // Check if operation succeeded.
1027
1231
  if (bytes >= 0)
1028
1232
  {
1029
- ec = asio::error_code();
1030
1233
  bytes_transferred = bytes;
1234
+ return true;
1031
1235
  }
1032
- else
1033
- bytes_transferred = 0;
1034
1236
 
1237
+ // Retry operation if interrupted by signal.
1238
+ if (ec == asio::error::interrupted)
1239
+ continue;
1240
+
1241
+ // Check if we need to run the operation again.
1242
+ if (ec == asio::error::would_block
1243
+ || ec == asio::error::try_again)
1244
+ return false;
1245
+
1246
+ // Operation failed.
1247
+ bytes_transferred = 0;
1035
1248
  return true;
1036
1249
  }
1037
1250
  }
@@ -1041,7 +1254,6 @@ bool non_blocking_recvfrom(socket_type s,
1041
1254
  signed_size_type recvmsg(socket_type s, buf* bufs, size_t count,
1042
1255
  int in_flags, int& out_flags, asio::error_code& ec)
1043
1256
  {
1044
- clear_last_error();
1045
1257
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1046
1258
  out_flags = 0;
1047
1259
  return socket_ops::recv(s, bufs, count, in_flags, ec);
@@ -1049,12 +1261,10 @@ signed_size_type recvmsg(socket_type s, buf* bufs, size_t count,
1049
1261
  msghdr msg = msghdr();
1050
1262
  msg.msg_iov = bufs;
1051
1263
  msg.msg_iovlen = static_cast<int>(count);
1052
- signed_size_type result = error_wrapper(::recvmsg(s, &msg, in_flags), ec);
1264
+ signed_size_type result = ::recvmsg(s, &msg, in_flags);
1265
+ get_last_error(ec, result < 0);
1053
1266
  if (result >= 0)
1054
- {
1055
- ec = asio::error_code();
1056
1267
  out_flags = msg.msg_flags;
1057
- }
1058
1268
  else
1059
1269
  out_flags = 0;
1060
1270
  return result;
@@ -1130,6 +1340,13 @@ bool non_blocking_recvmsg(socket_type s,
1130
1340
  signed_size_type bytes = socket_ops::recvmsg(
1131
1341
  s, bufs, count, in_flags, out_flags, ec);
1132
1342
 
1343
+ // Check if operation succeeded.
1344
+ if (bytes >= 0)
1345
+ {
1346
+ bytes_transferred = bytes;
1347
+ return true;
1348
+ }
1349
+
1133
1350
  // Retry operation if interrupted by signal.
1134
1351
  if (ec == asio::error::interrupted)
1135
1352
  continue;
@@ -1139,15 +1356,8 @@ bool non_blocking_recvmsg(socket_type s,
1139
1356
  || ec == asio::error::try_again)
1140
1357
  return false;
1141
1358
 
1142
- // Operation is complete.
1143
- if (bytes >= 0)
1144
- {
1145
- ec = asio::error_code();
1146
- bytes_transferred = bytes;
1147
- }
1148
- else
1149
- bytes_transferred = 0;
1150
-
1359
+ // Operation failed.
1360
+ bytes_transferred = 0;
1151
1361
  return true;
1152
1362
  }
1153
1363
  }
@@ -1157,21 +1367,21 @@ bool non_blocking_recvmsg(socket_type s,
1157
1367
  signed_size_type send(socket_type s, const buf* bufs, size_t count,
1158
1368
  int flags, asio::error_code& ec)
1159
1369
  {
1160
- clear_last_error();
1161
1370
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1162
1371
  // Send the data.
1163
1372
  DWORD send_buf_count = static_cast<DWORD>(count);
1164
1373
  DWORD bytes_transferred = 0;
1165
1374
  DWORD send_flags = flags;
1166
- int result = error_wrapper(::WSASend(s, const_cast<buf*>(bufs),
1167
- send_buf_count, &bytes_transferred, send_flags, 0, 0), ec);
1375
+ int result = ::WSASend(s, const_cast<buf*>(bufs),
1376
+ send_buf_count, &bytes_transferred, send_flags, 0, 0);
1377
+ get_last_error(ec, true);
1168
1378
  if (ec.value() == ERROR_NETNAME_DELETED)
1169
1379
  ec = asio::error::connection_reset;
1170
1380
  else if (ec.value() == ERROR_PORT_UNREACHABLE)
1171
1381
  ec = asio::error::connection_refused;
1172
1382
  if (result != 0)
1173
1383
  return socket_error_retval;
1174
- ec = asio::error_code();
1384
+ ec.assign(0, ec.category());
1175
1385
  return bytes_transferred;
1176
1386
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1177
1387
  msghdr msg = msghdr();
@@ -1180,9 +1390,40 @@ signed_size_type send(socket_type s, const buf* bufs, size_t count,
1180
1390
  #if defined(__linux__)
1181
1391
  flags |= MSG_NOSIGNAL;
1182
1392
  #endif // defined(__linux__)
1183
- signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec);
1184
- if (result >= 0)
1185
- ec = asio::error_code();
1393
+ signed_size_type result = ::sendmsg(s, &msg, flags);
1394
+ get_last_error(ec, result < 0);
1395
+ return result;
1396
+ #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1397
+ }
1398
+
1399
+ signed_size_type send1(socket_type s, const void* data, size_t size,
1400
+ int flags, asio::error_code& ec)
1401
+ {
1402
+ #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1403
+ // Send the data.
1404
+ WSABUF buf;
1405
+ buf.buf = const_cast<char*>(static_cast<const char*>(data));
1406
+ buf.len = static_cast<ULONG>(size);
1407
+ DWORD bytes_transferred = 0;
1408
+ DWORD send_flags = flags;
1409
+ int result = ::WSASend(s, &buf, 1,
1410
+ &bytes_transferred, send_flags, 0, 0);
1411
+ get_last_error(ec, true);
1412
+ if (ec.value() == ERROR_NETNAME_DELETED)
1413
+ ec = asio::error::connection_reset;
1414
+ else if (ec.value() == ERROR_PORT_UNREACHABLE)
1415
+ ec = asio::error::connection_refused;
1416
+ if (result != 0)
1417
+ return socket_error_retval;
1418
+ ec.assign(0, ec.category());
1419
+ return bytes_transferred;
1420
+ #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1421
+ #if defined(__linux__)
1422
+ flags |= MSG_NOSIGNAL;
1423
+ #endif // defined(__linux__)
1424
+ signed_size_type result = ::send(s,
1425
+ static_cast<const char*>(data), size, flags);
1426
+ get_last_error(ec, result < 0);
1186
1427
  return result;
1187
1428
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1188
1429
  }
@@ -1199,7 +1440,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs,
1199
1440
  // A request to write 0 bytes to a stream is a no-op.
1200
1441
  if (all_empty && (state & stream_oriented))
1201
1442
  {
1202
- ec = asio::error_code();
1443
+ ec.assign(0, ec.category());
1203
1444
  return 0;
1204
1445
  }
1205
1446
 
@@ -1225,6 +1466,44 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs,
1225
1466
  }
1226
1467
  }
1227
1468
 
1469
+ size_t sync_send1(socket_type s, state_type state, const void* data,
1470
+ size_t size, int flags, asio::error_code& ec)
1471
+ {
1472
+ if (s == invalid_socket)
1473
+ {
1474
+ ec = asio::error::bad_descriptor;
1475
+ return 0;
1476
+ }
1477
+
1478
+ // A request to write 0 bytes to a stream is a no-op.
1479
+ if (size == 0 && (state & stream_oriented))
1480
+ {
1481
+ ec.assign(0, ec.category());
1482
+ return 0;
1483
+ }
1484
+
1485
+ // Read some data.
1486
+ for (;;)
1487
+ {
1488
+ // Try to complete the operation without blocking.
1489
+ signed_size_type bytes = socket_ops::send1(s, data, size, flags, ec);
1490
+
1491
+ // Check if operation succeeded.
1492
+ if (bytes >= 0)
1493
+ return bytes;
1494
+
1495
+ // Operation failed.
1496
+ if ((state & user_set_non_blocking)
1497
+ || (ec != asio::error::would_block
1498
+ && ec != asio::error::try_again))
1499
+ return 0;
1500
+
1501
+ // Wait for socket to become ready.
1502
+ if (socket_ops::poll_write(s, 0, -1, ec) < 0)
1503
+ return 0;
1504
+ }
1505
+ }
1506
+
1228
1507
  #if defined(ASIO_HAS_IOCP)
1229
1508
 
1230
1509
  void complete_iocp_send(
@@ -1256,6 +1535,13 @@ bool non_blocking_send(socket_type s,
1256
1535
  // Write some data.
1257
1536
  signed_size_type bytes = socket_ops::send(s, bufs, count, flags, ec);
1258
1537
 
1538
+ // Check if operation succeeded.
1539
+ if (bytes >= 0)
1540
+ {
1541
+ bytes_transferred = bytes;
1542
+ return true;
1543
+ }
1544
+
1259
1545
  // Retry operation if interrupted by signal.
1260
1546
  if (ec == asio::error::interrupted)
1261
1547
  continue;
@@ -1265,15 +1551,39 @@ bool non_blocking_send(socket_type s,
1265
1551
  || ec == asio::error::try_again)
1266
1552
  return false;
1267
1553
 
1268
- // Operation is complete.
1554
+ // Operation failed.
1555
+ bytes_transferred = 0;
1556
+ return true;
1557
+ }
1558
+ }
1559
+
1560
+ bool non_blocking_send1(socket_type s,
1561
+ const void* data, size_t size, int flags,
1562
+ asio::error_code& ec, size_t& bytes_transferred)
1563
+ {
1564
+ for (;;)
1565
+ {
1566
+ // Write some data.
1567
+ signed_size_type bytes = socket_ops::send1(s, data, size, flags, ec);
1568
+
1569
+ // Check if operation succeeded.
1269
1570
  if (bytes >= 0)
1270
1571
  {
1271
- ec = asio::error_code();
1272
1572
  bytes_transferred = bytes;
1573
+ return true;
1273
1574
  }
1274
- else
1275
- bytes_transferred = 0;
1276
1575
 
1576
+ // Retry operation if interrupted by signal.
1577
+ if (ec == asio::error::interrupted)
1578
+ continue;
1579
+
1580
+ // Check if we need to run the operation again.
1581
+ if (ec == asio::error::would_block
1582
+ || ec == asio::error::try_again)
1583
+ return false;
1584
+
1585
+ // Operation failed.
1586
+ bytes_transferred = 0;
1277
1587
  return true;
1278
1588
  }
1279
1589
  }
@@ -1284,21 +1594,21 @@ signed_size_type sendto(socket_type s, const buf* bufs, size_t count,
1284
1594
  int flags, const socket_addr_type* addr, std::size_t addrlen,
1285
1595
  asio::error_code& ec)
1286
1596
  {
1287
- clear_last_error();
1288
1597
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1289
1598
  // Send the data.
1290
1599
  DWORD send_buf_count = static_cast<DWORD>(count);
1291
1600
  DWORD bytes_transferred = 0;
1292
- int result = error_wrapper(::WSASendTo(s, const_cast<buf*>(bufs),
1601
+ int result = ::WSASendTo(s, const_cast<buf*>(bufs),
1293
1602
  send_buf_count, &bytes_transferred, flags, addr,
1294
- static_cast<int>(addrlen), 0, 0), ec);
1603
+ static_cast<int>(addrlen), 0, 0);
1604
+ get_last_error(ec, true);
1295
1605
  if (ec.value() == ERROR_NETNAME_DELETED)
1296
1606
  ec = asio::error::connection_reset;
1297
1607
  else if (ec.value() == ERROR_PORT_UNREACHABLE)
1298
1608
  ec = asio::error::connection_refused;
1299
1609
  if (result != 0)
1300
1610
  return socket_error_retval;
1301
- ec = asio::error_code();
1611
+ ec.assign(0, ec.category());
1302
1612
  return bytes_transferred;
1303
1613
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1304
1614
  msghdr msg = msghdr();
@@ -1309,9 +1619,49 @@ signed_size_type sendto(socket_type s, const buf* bufs, size_t count,
1309
1619
  #if defined(__linux__)
1310
1620
  flags |= MSG_NOSIGNAL;
1311
1621
  #endif // defined(__linux__)
1312
- signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec);
1313
- if (result >= 0)
1314
- ec = asio::error_code();
1622
+ signed_size_type result = ::sendmsg(s, &msg, flags);
1623
+ get_last_error(ec, result < 0);
1624
+ return result;
1625
+ #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1626
+ }
1627
+
1628
+ template <typename SockLenType>
1629
+ inline signed_size_type call_sendto(SockLenType msghdr::*,
1630
+ socket_type s, const void* data, size_t size, int flags,
1631
+ const socket_addr_type* addr, std::size_t addrlen)
1632
+ {
1633
+ return ::sendto(s, static_cast<char*>(const_cast<void*>(data)),
1634
+ size, flags, addr, (SockLenType)addrlen);
1635
+ }
1636
+
1637
+ signed_size_type sendto1(socket_type s, const void* data, size_t size,
1638
+ int flags, const socket_addr_type* addr, std::size_t addrlen,
1639
+ asio::error_code& ec)
1640
+ {
1641
+ #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1642
+ // Send the data.
1643
+ WSABUF buf;
1644
+ buf.buf = const_cast<char*>(static_cast<const char*>(data));
1645
+ buf.len = static_cast<ULONG>(size);
1646
+ DWORD bytes_transferred = 0;
1647
+ int result = ::WSASendTo(s, &buf, 1, &bytes_transferred,
1648
+ flags, addr, static_cast<int>(addrlen), 0, 0);
1649
+ get_last_error(ec, true);
1650
+ if (ec.value() == ERROR_NETNAME_DELETED)
1651
+ ec = asio::error::connection_reset;
1652
+ else if (ec.value() == ERROR_PORT_UNREACHABLE)
1653
+ ec = asio::error::connection_refused;
1654
+ if (result != 0)
1655
+ return socket_error_retval;
1656
+ ec.assign(0, ec.category());
1657
+ return bytes_transferred;
1658
+ #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1659
+ #if defined(__linux__)
1660
+ flags |= MSG_NOSIGNAL;
1661
+ #endif // defined(__linux__)
1662
+ signed_size_type result = call_sendto(&msghdr::msg_namelen,
1663
+ s, data, size, flags, addr, addrlen);
1664
+ get_last_error(ec, result < 0);
1315
1665
  return result;
1316
1666
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1317
1667
  }
@@ -1349,6 +1699,39 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs,
1349
1699
  }
1350
1700
  }
1351
1701
 
1702
+ size_t sync_sendto1(socket_type s, state_type state, const void* data,
1703
+ size_t size, int flags, const socket_addr_type* addr,
1704
+ std::size_t addrlen, asio::error_code& ec)
1705
+ {
1706
+ if (s == invalid_socket)
1707
+ {
1708
+ ec = asio::error::bad_descriptor;
1709
+ return 0;
1710
+ }
1711
+
1712
+ // Write some data.
1713
+ for (;;)
1714
+ {
1715
+ // Try to complete the operation without blocking.
1716
+ signed_size_type bytes = socket_ops::sendto1(
1717
+ s, data, size, flags, addr, addrlen, ec);
1718
+
1719
+ // Check if operation succeeded.
1720
+ if (bytes >= 0)
1721
+ return bytes;
1722
+
1723
+ // Operation failed.
1724
+ if ((state & user_set_non_blocking)
1725
+ || (ec != asio::error::would_block
1726
+ && ec != asio::error::try_again))
1727
+ return 0;
1728
+
1729
+ // Wait for socket to become ready.
1730
+ if (socket_ops::poll_write(s, 0, -1, ec) < 0)
1731
+ return 0;
1732
+ }
1733
+ }
1734
+
1352
1735
  #if !defined(ASIO_HAS_IOCP)
1353
1736
 
1354
1737
  bool non_blocking_sendto(socket_type s,
@@ -1362,6 +1745,13 @@ bool non_blocking_sendto(socket_type s,
1362
1745
  signed_size_type bytes = socket_ops::sendto(
1363
1746
  s, bufs, count, flags, addr, addrlen, ec);
1364
1747
 
1748
+ // Check if operation succeeded.
1749
+ if (bytes >= 0)
1750
+ {
1751
+ bytes_transferred = bytes;
1752
+ return true;
1753
+ }
1754
+
1365
1755
  // Retry operation if interrupted by signal.
1366
1756
  if (ec == asio::error::interrupted)
1367
1757
  continue;
@@ -1371,15 +1761,41 @@ bool non_blocking_sendto(socket_type s,
1371
1761
  || ec == asio::error::try_again)
1372
1762
  return false;
1373
1763
 
1374
- // Operation is complete.
1764
+ // Operation failed.
1765
+ bytes_transferred = 0;
1766
+ return true;
1767
+ }
1768
+ }
1769
+
1770
+ bool non_blocking_sendto1(socket_type s,
1771
+ const void* data, size_t size, int flags,
1772
+ const socket_addr_type* addr, std::size_t addrlen,
1773
+ asio::error_code& ec, size_t& bytes_transferred)
1774
+ {
1775
+ for (;;)
1776
+ {
1777
+ // Write some data.
1778
+ signed_size_type bytes = socket_ops::sendto1(
1779
+ s, data, size, flags, addr, addrlen, ec);
1780
+
1781
+ // Check if operation succeeded.
1375
1782
  if (bytes >= 0)
1376
1783
  {
1377
- ec = asio::error_code();
1378
1784
  bytes_transferred = bytes;
1785
+ return true;
1379
1786
  }
1380
- else
1381
- bytes_transferred = 0;
1382
1787
 
1788
+ // Retry operation if interrupted by signal.
1789
+ if (ec == asio::error::interrupted)
1790
+ continue;
1791
+
1792
+ // Check if we need to run the operation again.
1793
+ if (ec == asio::error::would_block
1794
+ || ec == asio::error::try_again)
1795
+ return false;
1796
+
1797
+ // Operation failed.
1798
+ bytes_transferred = 0;
1383
1799
  return true;
1384
1800
  }
1385
1801
  }
@@ -1389,10 +1805,9 @@ bool non_blocking_sendto(socket_type s,
1389
1805
  socket_type socket(int af, int type, int protocol,
1390
1806
  asio::error_code& ec)
1391
1807
  {
1392
- clear_last_error();
1393
1808
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1394
- socket_type s = error_wrapper(::WSASocketW(af, type, protocol, 0, 0,
1395
- WSA_FLAG_OVERLAPPED), ec);
1809
+ socket_type s = ::WSASocketW(af, type, protocol, 0, 0, WSA_FLAG_OVERLAPPED);
1810
+ get_last_error(ec, s == invalid_socket);
1396
1811
  if (s == invalid_socket)
1397
1812
  return s;
1398
1813
 
@@ -1406,17 +1821,15 @@ socket_type socket(int af, int type, int protocol,
1406
1821
  reinterpret_cast<const char*>(&optval), sizeof(optval));
1407
1822
  }
1408
1823
 
1409
- ec = asio::error_code();
1410
-
1411
1824
  return s;
1412
1825
  #elif defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__)
1413
- socket_type s = error_wrapper(::socket(af, type, protocol), ec);
1414
- if (s == invalid_socket)
1415
- return s;
1826
+ socket_type s = ::socket(af, type, protocol);
1827
+ get_last_error(ec, s < 0);
1416
1828
 
1417
1829
  int optval = 1;
1418
- int result = error_wrapper(::setsockopt(s,
1419
- SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval)), ec);
1830
+ int result = ::setsockopt(s, SOL_SOCKET,
1831
+ SO_NOSIGPIPE, &optval, sizeof(optval));
1832
+ get_last_error(ec, result != 0);
1420
1833
  if (result != 0)
1421
1834
  {
1422
1835
  ::close(s);
@@ -1425,9 +1838,8 @@ socket_type socket(int af, int type, int protocol,
1425
1838
 
1426
1839
  return s;
1427
1840
  #else
1428
- int s = error_wrapper(::socket(af, type, protocol), ec);
1429
- if (s >= 0)
1430
- ec = asio::error_code();
1841
+ int s = ::socket(af, type, protocol);
1842
+ get_last_error(ec, s < 0);
1431
1843
  return s;
1432
1844
  #endif
1433
1845
  }
@@ -1469,7 +1881,7 @@ int setsockopt(socket_type s, state_type& state, int level, int optname,
1469
1881
  state |= enable_connection_aborted;
1470
1882
  else
1471
1883
  state &= ~enable_connection_aborted;
1472
- ec = asio::error_code();
1884
+ ec.assign(0, ec.category());
1473
1885
  return 0;
1474
1886
  }
1475
1887
 
@@ -1485,22 +1897,21 @@ int setsockopt(socket_type s, state_type& state, int level, int optname,
1485
1897
  typedef int (WSAAPI *sso_t)(SOCKET, int, int, const char*, int);
1486
1898
  if (sso_t sso = (sso_t)::GetProcAddress(winsock_module, "setsockopt"))
1487
1899
  {
1488
- clear_last_error();
1489
- return error_wrapper(sso(s, level, optname,
1900
+ int result = sso(s, level, optname,
1490
1901
  reinterpret_cast<const char*>(optval),
1491
- static_cast<int>(optlen)), ec);
1902
+ static_cast<int>(optlen));
1903
+ get_last_error(ec, result != 0);
1904
+ return result;
1492
1905
  }
1493
1906
  }
1494
1907
  ec = asio::error::fault;
1495
1908
  return socket_error_retval;
1496
1909
  #else // defined(__BORLANDC__)
1497
- clear_last_error();
1498
- int result = error_wrapper(call_setsockopt(&msghdr::msg_namelen,
1499
- s, level, optname, optval, optlen), ec);
1910
+ int result = call_setsockopt(&msghdr::msg_namelen,
1911
+ s, level, optname, optval, optlen);
1912
+ get_last_error(ec, result != 0);
1500
1913
  if (result == 0)
1501
1914
  {
1502
- ec = asio::error_code();
1503
-
1504
1915
  #if defined(__MACH__) && defined(__APPLE__) \
1505
1916
  || defined(__NetBSD__) || defined(__FreeBSD__) \
1506
1917
  || defined(__OpenBSD__) || defined(__QNX__)
@@ -1555,7 +1966,7 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1555
1966
  }
1556
1967
 
1557
1968
  *static_cast<int*>(optval) = (state & enable_connection_aborted) ? 1 : 0;
1558
- ec = asio::error_code();
1969
+ ec.assign(0, ec.category());
1559
1970
  return 0;
1560
1971
  }
1561
1972
 
@@ -1568,10 +1979,10 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1568
1979
  typedef int (WSAAPI *gso_t)(SOCKET, int, int, char*, int*);
1569
1980
  if (gso_t gso = (gso_t)::GetProcAddress(winsock_module, "getsockopt"))
1570
1981
  {
1571
- clear_last_error();
1572
1982
  int tmp_optlen = static_cast<int>(*optlen);
1573
- int result = error_wrapper(gso(s, level, optname,
1574
- reinterpret_cast<char*>(optval), &tmp_optlen), ec);
1983
+ int result = gso(s, level, optname,
1984
+ reinterpret_cast<char*>(optval), &tmp_optlen);
1985
+ get_last_error(ec, result != 0);
1575
1986
  *optlen = static_cast<size_t>(tmp_optlen);
1576
1987
  if (result != 0 && level == IPPROTO_IPV6 && optname == IPV6_V6ONLY
1577
1988
  && ec.value() == WSAENOPROTOOPT && *optlen == sizeof(DWORD))
@@ -1582,7 +1993,7 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1582
1993
  // value is non-zero (i.e. true). This corresponds to the behavior of
1583
1994
  // IPv6 sockets on Windows platforms pre-Vista.
1584
1995
  *static_cast<DWORD*>(optval) = 1;
1585
- ec = asio::error_code();
1996
+ ec.assign(0, ec.category());
1586
1997
  }
1587
1998
  return result;
1588
1999
  }
@@ -1590,9 +2001,9 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1590
2001
  ec = asio::error::fault;
1591
2002
  return socket_error_retval;
1592
2003
  #elif defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1593
- clear_last_error();
1594
- int result = error_wrapper(call_getsockopt(&msghdr::msg_namelen,
1595
- s, level, optname, optval, optlen), ec);
2004
+ int result = call_getsockopt(&msghdr::msg_namelen,
2005
+ s, level, optname, optval, optlen);
2006
+ get_last_error(ec, result != 0);
1596
2007
  if (result != 0 && level == IPPROTO_IPV6 && optname == IPV6_V6ONLY
1597
2008
  && ec.value() == WSAENOPROTOOPT && *optlen == sizeof(DWORD))
1598
2009
  {
@@ -1602,15 +2013,13 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1602
2013
  // non-zero (i.e. true). This corresponds to the behavior of IPv6 sockets
1603
2014
  // on Windows platforms pre-Vista.
1604
2015
  *static_cast<DWORD*>(optval) = 1;
1605
- ec = asio::error_code();
2016
+ ec.assign(0, ec.category());
1606
2017
  }
1607
- if (result == 0)
1608
- ec = asio::error_code();
1609
2018
  return result;
1610
2019
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1611
- clear_last_error();
1612
- int result = error_wrapper(call_getsockopt(&msghdr::msg_namelen,
1613
- s, level, optname, optval, optlen), ec);
2020
+ int result = call_getsockopt(&msghdr::msg_namelen,
2021
+ s, level, optname, optval, optlen);
2022
+ get_last_error(ec, result != 0);
1614
2023
  #if defined(__linux__)
1615
2024
  if (result == 0 && level == SOL_SOCKET && *optlen == sizeof(int)
1616
2025
  && (optname == SO_SNDBUF || optname == SO_RCVBUF))
@@ -1623,8 +2032,6 @@ int getsockopt(socket_type s, state_type state, int level, int optname,
1623
2032
  *static_cast<int*>(optval) /= 2;
1624
2033
  }
1625
2034
  #endif // defined(__linux__)
1626
- if (result == 0)
1627
- ec = asio::error_code();
1628
2035
  return result;
1629
2036
  #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1630
2037
  }
@@ -1667,7 +2074,7 @@ int getpeername(socket_type s, socket_addr_type* addr,
1667
2074
  }
1668
2075
 
1669
2076
  // The cached value is still valid.
1670
- ec = asio::error_code();
2077
+ ec.assign(0, ec.category());
1671
2078
  return 0;
1672
2079
  }
1673
2080
  #else // defined(ASIO_WINDOWS) && !defined(ASIO_WINDOWS_APP)
@@ -1676,11 +2083,8 @@ int getpeername(socket_type s, socket_addr_type* addr,
1676
2083
  #endif // defined(ASIO_WINDOWS) && !defined(ASIO_WINDOWS_APP)
1677
2084
  // || defined(__CYGWIN__)
1678
2085
 
1679
- clear_last_error();
1680
- int result = error_wrapper(call_getpeername(
1681
- &msghdr::msg_namelen, s, addr, addrlen), ec);
1682
- if (result == 0)
1683
- ec = asio::error_code();
2086
+ int result = call_getpeername(&msghdr::msg_namelen, s, addr, addrlen);
2087
+ get_last_error(ec, result != 0);
1684
2088
  return result;
1685
2089
  }
1686
2090
 
@@ -1703,11 +2107,8 @@ int getsockname(socket_type s, socket_addr_type* addr,
1703
2107
  return socket_error_retval;
1704
2108
  }
1705
2109
 
1706
- clear_last_error();
1707
- int result = error_wrapper(call_getsockname(
1708
- &msghdr::msg_namelen, s, addr, addrlen), ec);
1709
- if (result == 0)
1710
- ec = asio::error_code();
2110
+ int result = call_getsockname(&msghdr::msg_namelen, s, addr, addrlen);
2111
+ get_last_error(ec, result != 0);
1711
2112
  return result;
1712
2113
  }
1713
2114
 
@@ -1720,20 +2121,17 @@ int ioctl(socket_type s, state_type& state, int cmd,
1720
2121
  return socket_error_retval;
1721
2122
  }
1722
2123
 
1723
- clear_last_error();
1724
2124
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1725
- int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec);
2125
+ int result = ::ioctlsocket(s, cmd, arg);
1726
2126
  #elif defined(__MACH__) && defined(__APPLE__) \
1727
2127
  || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
1728
- int result = error_wrapper(::ioctl(s,
1729
- static_cast<unsigned int>(cmd), arg), ec);
2128
+ int result = ::ioctl(s, static_cast<unsigned int>(cmd), arg);
1730
2129
  #else
1731
- int result = error_wrapper(::ioctl(s, cmd, arg), ec);
2130
+ int result = ::ioctl(s, cmd, arg);
1732
2131
  #endif
2132
+ get_last_error(ec, result < 0);
1733
2133
  if (result >= 0)
1734
2134
  {
1735
- ec = asio::error_code();
1736
-
1737
2135
  // When updating the non-blocking mode we always perform the ioctl syscall,
1738
2136
  // even if the flags would otherwise indicate that the socket is already in
1739
2137
  // the correct state. This ensures that the underlying socket is put into
@@ -1761,7 +2159,6 @@ int ioctl(socket_type s, state_type& state, int cmd,
1761
2159
  int select(int nfds, fd_set* readfds, fd_set* writefds,
1762
2160
  fd_set* exceptfds, timeval* timeout, asio::error_code& ec)
1763
2161
  {
1764
- clear_last_error();
1765
2162
  #if defined(__EMSCRIPTEN__)
1766
2163
  exceptfds = 0;
1767
2164
  #endif // defined(__EMSCRIPTEN__)
@@ -1772,7 +2169,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds,
1772
2169
  if (milliseconds == 0)
1773
2170
  milliseconds = 1; // Force context switch.
1774
2171
  ::Sleep(milliseconds);
1775
- ec = asio::error_code();
2172
+ ec.assign(0, ec.category());
1776
2173
  return 0;
1777
2174
  }
1778
2175
 
@@ -1791,15 +2188,13 @@ int select(int nfds, fd_set* readfds, fd_set* writefds,
1791
2188
  timespec ts;
1792
2189
  ts.tv_sec = timeout ? timeout->tv_sec : 0;
1793
2190
  ts.tv_nsec = timeout ? timeout->tv_usec * 1000 : 0;
1794
- return error_wrapper(::pselect(nfds, readfds,
1795
- writefds, exceptfds, timeout ? &ts : 0, 0), ec);
2191
+ int result = ::pselect(nfds, readfds,
2192
+ writefds, exceptfds, timeout ? &ts : 0, 0);
1796
2193
  #else
1797
- int result = error_wrapper(::select(nfds, readfds,
1798
- writefds, exceptfds, timeout), ec);
1799
- if (result >= 0)
1800
- ec = asio::error_code();
1801
- return result;
2194
+ int result = ::select(nfds, readfds, writefds, exceptfds, timeout);
1802
2195
  #endif
2196
+ get_last_error(ec, result < 0);
2197
+ return result;
1803
2198
  }
1804
2199
 
1805
2200
  int poll_read(socket_type s, state_type state,
@@ -1833,8 +2228,8 @@ int poll_read(socket_type s, state_type state,
1833
2228
  }
1834
2229
  else
1835
2230
  timeout = 0;
1836
- clear_last_error();
1837
- int result = error_wrapper(::select(s + 1, &fds, 0, 0, timeout), ec);
2231
+ int result = ::select(s + 1, &fds, 0, 0, timeout);
2232
+ get_last_error(ec, result < 0);
1838
2233
  #else // defined(ASIO_WINDOWS)
1839
2234
  // || defined(__CYGWIN__)
1840
2235
  // || defined(__SYMBIAN32__)
@@ -1843,16 +2238,14 @@ int poll_read(socket_type s, state_type state,
1843
2238
  fds.events = POLLIN;
1844
2239
  fds.revents = 0;
1845
2240
  int timeout = (state & user_set_non_blocking) ? 0 : msec;
1846
- clear_last_error();
1847
- int result = error_wrapper(::poll(&fds, 1, timeout), ec);
2241
+ int result = ::poll(&fds, 1, timeout);
2242
+ get_last_error(ec, result < 0);
1848
2243
  #endif // defined(ASIO_WINDOWS)
1849
2244
  // || defined(__CYGWIN__)
1850
2245
  // || defined(__SYMBIAN32__)
1851
2246
  if (result == 0)
1852
- ec = (state & user_set_non_blocking)
1853
- ? asio::error::would_block : asio::error_code();
1854
- else if (result > 0)
1855
- ec = asio::error_code();
2247
+ if (state & user_set_non_blocking)
2248
+ ec = asio::error::would_block;
1856
2249
  return result;
1857
2250
  }
1858
2251
 
@@ -1887,8 +2280,8 @@ int poll_write(socket_type s, state_type state,
1887
2280
  }
1888
2281
  else
1889
2282
  timeout = 0;
1890
- clear_last_error();
1891
- int result = error_wrapper(::select(s + 1, 0, &fds, 0, timeout), ec);
2283
+ int result = ::select(s + 1, 0, &fds, 0, timeout);
2284
+ get_last_error(ec, result < 0);
1892
2285
  #else // defined(ASIO_WINDOWS)
1893
2286
  // || defined(__CYGWIN__)
1894
2287
  // || defined(__SYMBIAN32__)
@@ -1897,16 +2290,14 @@ int poll_write(socket_type s, state_type state,
1897
2290
  fds.events = POLLOUT;
1898
2291
  fds.revents = 0;
1899
2292
  int timeout = (state & user_set_non_blocking) ? 0 : msec;
1900
- clear_last_error();
1901
- int result = error_wrapper(::poll(&fds, 1, timeout), ec);
2293
+ int result = ::poll(&fds, 1, timeout);
2294
+ get_last_error(ec, result < 0);
1902
2295
  #endif // defined(ASIO_WINDOWS)
1903
2296
  // || defined(__CYGWIN__)
1904
2297
  // || defined(__SYMBIAN32__)
1905
2298
  if (result == 0)
1906
- ec = (state & user_set_non_blocking)
1907
- ? asio::error::would_block : asio::error_code();
1908
- else if (result > 0)
1909
- ec = asio::error_code();
2299
+ if (state & user_set_non_blocking)
2300
+ ec = asio::error::would_block;
1910
2301
  return result;
1911
2302
  }
1912
2303
 
@@ -1941,8 +2332,8 @@ int poll_error(socket_type s, state_type state,
1941
2332
  }
1942
2333
  else
1943
2334
  timeout = 0;
1944
- clear_last_error();
1945
- int result = error_wrapper(::select(s + 1, 0, 0, &fds, timeout), ec);
2335
+ int result = ::select(s + 1, 0, 0, &fds, timeout);
2336
+ get_last_error(ec, result < 0);
1946
2337
  #else // defined(ASIO_WINDOWS)
1947
2338
  // || defined(__CYGWIN__)
1948
2339
  // || defined(__SYMBIAN32__)
@@ -1951,16 +2342,14 @@ int poll_error(socket_type s, state_type state,
1951
2342
  fds.events = POLLPRI | POLLERR | POLLHUP;
1952
2343
  fds.revents = 0;
1953
2344
  int timeout = (state & user_set_non_blocking) ? 0 : msec;
1954
- clear_last_error();
1955
- int result = error_wrapper(::poll(&fds, 1, timeout), ec);
2345
+ int result = ::poll(&fds, 1, timeout);
2346
+ get_last_error(ec, result < 0);
1956
2347
  #endif // defined(ASIO_WINDOWS)
1957
2348
  // || defined(__CYGWIN__)
1958
2349
  // || defined(__SYMBIAN32__)
1959
2350
  if (result == 0)
1960
- ec = (state & user_set_non_blocking)
1961
- ? asio::error::would_block : asio::error_code();
1962
- else if (result > 0)
1963
- ec = asio::error_code();
2351
+ if (state & user_set_non_blocking)
2352
+ ec = asio::error::would_block;
1964
2353
  return result;
1965
2354
  }
1966
2355
 
@@ -1991,11 +2380,8 @@ int poll_connect(socket_type s, int msec, asio::error_code& ec)
1991
2380
  }
1992
2381
  else
1993
2382
  timeout = 0;
1994
- clear_last_error();
1995
- int result = error_wrapper(::select(
1996
- s + 1, 0, &write_fds, &except_fds, timeout), ec);
1997
- if (result >= 0)
1998
- ec = asio::error_code();
2383
+ int result = ::select(s + 1, 0, &write_fds, &except_fds, timeout);
2384
+ get_last_error(ec, result < 0);
1999
2385
  return result;
2000
2386
  #else // defined(ASIO_WINDOWS)
2001
2387
  // || defined(__CYGWIN__)
@@ -2004,10 +2390,8 @@ int poll_connect(socket_type s, int msec, asio::error_code& ec)
2004
2390
  fds.fd = s;
2005
2391
  fds.events = POLLOUT;
2006
2392
  fds.revents = 0;
2007
- clear_last_error();
2008
- int result = error_wrapper(::poll(&fds, 1, msec), ec);
2009
- if (result >= 0)
2010
- ec = asio::error_code();
2393
+ int result = ::poll(&fds, 1, msec);
2394
+ get_last_error(ec, result < 0);
2011
2395
  return result;
2012
2396
  #endif // defined(ASIO_WINDOWS)
2013
2397
  // || defined(__CYGWIN__)
@@ -2092,18 +2476,20 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length,
2092
2476
  DWORD string_length = static_cast<DWORD>(length);
2093
2477
  #if defined(BOOST_NO_ANSI_APIS) || (defined(_MSC_VER) && (_MSC_VER >= 1800))
2094
2478
  LPWSTR string_buffer = (LPWSTR)_alloca(length * sizeof(WCHAR));
2095
- int result = error_wrapper(::WSAAddressToStringW(&address.base,
2096
- address_length, 0, string_buffer, &string_length), ec);
2479
+ int result = ::WSAAddressToStringW(&address.base,
2480
+ address_length, 0, string_buffer, &string_length);
2481
+ get_last_error(ec, true);
2097
2482
  ::WideCharToMultiByte(CP_ACP, 0, string_buffer, -1,
2098
2483
  dest, static_cast<int>(length), 0, 0);
2099
2484
  #else
2100
- int result = error_wrapper(::WSAAddressToStringA(
2101
- &address.base, address_length, 0, dest, &string_length), ec);
2485
+ int result = ::WSAAddressToStringA(&address.base,
2486
+ address_length, 0, dest, &string_length);
2487
+ get_last_error(ec, true);
2102
2488
  #endif
2103
2489
 
2104
2490
  // Windows may set error code on success.
2105
2491
  if (result != socket_error_retval)
2106
- ec = asio::error_code();
2492
+ ec.assign(0, ec.category());
2107
2493
 
2108
2494
  // Windows may not set an error code on failure.
2109
2495
  else if (result == socket_error_retval && !ec)
@@ -2111,8 +2497,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length,
2111
2497
 
2112
2498
  return result == socket_error_retval ? 0 : dest;
2113
2499
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
2114
- const char* result = error_wrapper(::inet_ntop(
2115
- af, src, dest, static_cast<int>(length)), ec);
2500
+ const char* result = ::inet_ntop(af, src, dest, static_cast<int>(length));
2501
+ get_last_error(ec, true);
2116
2502
  if (result == 0 && !ec)
2117
2503
  ec = asio::error::invalid_argument;
2118
2504
  if (result != 0 && af == ASIO_OS_DEF(AF_INET6) && scope_id != 0)
@@ -2157,7 +2543,7 @@ int inet_pton(int af, const char* src, void* dest,
2157
2543
  bytes[1] = static_cast<unsigned char>(b1);
2158
2544
  bytes[2] = static_cast<unsigned char>(b2);
2159
2545
  bytes[3] = static_cast<unsigned char>(b3);
2160
- ec = asio::error_code();
2546
+ ec.assign(), ec.category());
2161
2547
  return 1;
2162
2548
  }
2163
2549
  else if (af == ASIO_OS_DEF(AF_INET6))
@@ -2273,7 +2659,7 @@ int inet_pton(int af, const char* src, void* dest,
2273
2659
  for (int i = 0; i < num_back_bytes; ++i)
2274
2660
  bytes[16 - num_back_bytes + i] = back_bytes[i];
2275
2661
 
2276
- ec = asio::error_code();
2662
+ ec.assign(0, ec.category());
2277
2663
  return 1;
2278
2664
  }
2279
2665
  else
@@ -2302,11 +2688,13 @@ int inet_pton(int af, const char* src, void* dest,
2302
2688
  int num_wide_chars = static_cast<int>(strlen(src)) + 1;
2303
2689
  LPWSTR wide_buffer = (LPWSTR)_alloca(num_wide_chars * sizeof(WCHAR));
2304
2690
  ::MultiByteToWideChar(CP_ACP, 0, src, -1, wide_buffer, num_wide_chars);
2305
- int result = error_wrapper(::WSAStringToAddressW(
2306
- wide_buffer, af, 0, &address.base, &address_length), ec);
2691
+ int result = ::WSAStringToAddressW(wide_buffer,
2692
+ af, 0, &address.base, &address_length);
2693
+ get_last_error(ec, true);
2307
2694
  #else
2308
- int result = error_wrapper(::WSAStringToAddressA(
2309
- const_cast<char*>(src), af, 0, &address.base, &address_length), ec);
2695
+ int result = ::WSAStringToAddressA(const_cast<char*>(src),
2696
+ af, 0, &address.base, &address_length);
2697
+ get_last_error(ec, true);
2310
2698
  #endif
2311
2699
 
2312
2700
  if (af == ASIO_OS_DEF(AF_INET))
@@ -2314,12 +2702,12 @@ int inet_pton(int af, const char* src, void* dest,
2314
2702
  if (result != socket_error_retval)
2315
2703
  {
2316
2704
  memcpy(dest, &address.v4.sin_addr, sizeof(in4_addr_type));
2317
- ec = asio::error_code();
2705
+ ec.assign(0, ec.category());
2318
2706
  }
2319
2707
  else if (strcmp(src, "255.255.255.255") == 0)
2320
2708
  {
2321
2709
  static_cast<in4_addr_type*>(dest)->s_addr = INADDR_NONE;
2322
- ec = asio::error_code();
2710
+ ec.assign(0, ec.category());
2323
2711
  }
2324
2712
  }
2325
2713
  else // AF_INET6
@@ -2329,7 +2717,7 @@ int inet_pton(int af, const char* src, void* dest,
2329
2717
  memcpy(dest, &address.v6.sin6_addr, sizeof(in6_addr_type));
2330
2718
  if (scope_id)
2331
2719
  *scope_id = address.v6.sin6_scope_id;
2332
- ec = asio::error_code();
2720
+ ec.assign(0, ec.category());
2333
2721
  }
2334
2722
  }
2335
2723
 
@@ -2338,7 +2726,7 @@ int inet_pton(int af, const char* src, void* dest,
2338
2726
  ec = asio::error::invalid_argument;
2339
2727
 
2340
2728
  if (result != socket_error_retval)
2341
- ec = asio::error_code();
2729
+ ec.assign(0, ec.category());
2342
2730
 
2343
2731
  return result == socket_error_retval ? -1 : 1;
2344
2732
  #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
@@ -2362,7 +2750,8 @@ int inet_pton(int af, const char* src, void* dest,
2362
2750
  src_ptr = src_buf;
2363
2751
  }
2364
2752
 
2365
- int result = error_wrapper(::inet_pton(af, src_ptr, dest), ec);
2753
+ int result = ::inet_pton(af, src_ptr, dest);
2754
+ get_last_error(ec, true);
2366
2755
  if (result <= 0 && !ec)
2367
2756
  ec = asio::error::invalid_argument;
2368
2757
  if (result > 0 && is_v6 && scope_id)
@@ -2388,7 +2777,6 @@ int inet_pton(int af, const char* src, void* dest,
2388
2777
 
2389
2778
  int gethostname(char* name, int namelen, asio::error_code& ec)
2390
2779
  {
2391
- clear_last_error();
2392
2780
  #if defined(ASIO_WINDOWS_RUNTIME)
2393
2781
  try
2394
2782
  {
@@ -2419,11 +2807,8 @@ int gethostname(char* name, int namelen, asio::error_code& ec)
2419
2807
  return -1;
2420
2808
  }
2421
2809
  #else // defined(ASIO_WINDOWS_RUNTIME)
2422
- int result = error_wrapper(::gethostname(name, namelen), ec);
2423
- # if defined(ASIO_WINDOWS)
2424
- if (result == 0)
2425
- ec = asio::error_code();
2426
- # endif // defined(ASIO_WINDOWS)
2810
+ int result = ::gethostname(name, namelen);
2811
+ get_last_error(ec, result != 0);
2427
2812
  return result;
2428
2813
  #endif // defined(ASIO_WINDOWS_RUNTIME)
2429
2814
  }
@@ -2458,20 +2843,20 @@ inline asio::error_code translate_netdb_error(int error)
2458
2843
  inline hostent* gethostbyaddr(const char* addr, int length, int af,
2459
2844
  hostent* result, char* buffer, int buflength, asio::error_code& ec)
2460
2845
  {
2461
- clear_last_error();
2462
2846
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
2463
2847
  (void)(buffer);
2464
2848
  (void)(buflength);
2465
- hostent* retval = error_wrapper(::gethostbyaddr(addr, length, af), ec);
2849
+ hostent* retval = ::gethostbyaddr(addr, length, af);
2850
+ get_last_error(ec, !retval);
2466
2851
  if (!retval)
2467
2852
  return 0;
2468
- ec = asio::error_code();
2469
2853
  *result = *retval;
2470
2854
  return retval;
2471
2855
  #elif defined(__sun) || defined(__QNX__)
2472
2856
  int error = 0;
2473
- hostent* retval = error_wrapper(::gethostbyaddr_r(addr, length, af, result,
2474
- buffer, buflength, &error), ec);
2857
+ hostent* retval = ::gethostbyaddr_r(addr, length,
2858
+ af, result, buffer, buflength, &error);
2859
+ get_last_error(ec, !retval);
2475
2860
  if (error)
2476
2861
  ec = translate_netdb_error(error);
2477
2862
  return retval;
@@ -2479,8 +2864,8 @@ inline hostent* gethostbyaddr(const char* addr, int length, int af,
2479
2864
  (void)(buffer);
2480
2865
  (void)(buflength);
2481
2866
  int error = 0;
2482
- hostent* retval = error_wrapper(::getipnodebyaddr(
2483
- addr, length, af, &error), ec);
2867
+ hostent* retval = ::getipnodebyaddr(addr, length, af, &error);
2868
+ get_last_error(ec, !retval);
2484
2869
  if (error)
2485
2870
  ec = translate_netdb_error(error);
2486
2871
  if (!retval)
@@ -2490,8 +2875,10 @@ inline hostent* gethostbyaddr(const char* addr, int length, int af,
2490
2875
  #else
2491
2876
  hostent* retval = 0;
2492
2877
  int error = 0;
2493
- error_wrapper(::gethostbyaddr_r(addr, length, af, result, buffer,
2494
- buflength, &retval, &error), ec);
2878
+ clear_last_error();
2879
+ ::gethostbyaddr_r(addr, length, af, result,
2880
+ buffer, buflength, &retval, &error);
2881
+ get_last_error(ec, true);
2495
2882
  if (error)
2496
2883
  ec = translate_netdb_error(error);
2497
2884
  return retval;
@@ -2501,7 +2888,6 @@ inline hostent* gethostbyaddr(const char* addr, int length, int af,
2501
2888
  inline hostent* gethostbyname(const char* name, int af, struct hostent* result,
2502
2889
  char* buffer, int buflength, int ai_flags, asio::error_code& ec)
2503
2890
  {
2504
- clear_last_error();
2505
2891
  #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
2506
2892
  (void)(buffer);
2507
2893
  (void)(buflength);
@@ -2511,10 +2897,10 @@ inline hostent* gethostbyname(const char* name, int af, struct hostent* result,
2511
2897
  ec = asio::error::address_family_not_supported;
2512
2898
  return 0;
2513
2899
  }
2514
- hostent* retval = error_wrapper(::gethostbyname(name), ec);
2900
+ hostent* retval = ::gethostbyname(name);
2901
+ get_last_error(ec, !retval);
2515
2902
  if (!retval)
2516
2903
  return 0;
2517
- ec = asio::error_code();
2518
2904
  *result = *retval;
2519
2905
  return result;
2520
2906
  #elif defined(__sun) || defined(__QNX__)
@@ -2525,8 +2911,8 @@ inline hostent* gethostbyname(const char* name, int af, struct hostent* result,
2525
2911
  return 0;
2526
2912
  }
2527
2913
  int error = 0;
2528
- hostent* retval = error_wrapper(::gethostbyname_r(name, result, buffer,
2529
- buflength, &error), ec);
2914
+ hostent* retval = ::gethostbyname_r(name, result, buffer, buflength, &error);
2915
+ get_last_error(ec, !retval);
2530
2916
  if (error)
2531
2917
  ec = translate_netdb_error(error);
2532
2918
  return retval;
@@ -2534,8 +2920,8 @@ inline hostent* gethostbyname(const char* name, int af, struct hostent* result,
2534
2920
  (void)(buffer);
2535
2921
  (void)(buflength);
2536
2922
  int error = 0;
2537
- hostent* retval = error_wrapper(::getipnodebyname(
2538
- name, af, ai_flags, &error), ec);
2923
+ hostent* retval = ::getipnodebyname(name, af, ai_flags, &error);
2924
+ get_last_error(ec, !retval);
2539
2925
  if (error)
2540
2926
  ec = translate_netdb_error(error);
2541
2927
  if (!retval)
@@ -2551,8 +2937,9 @@ inline hostent* gethostbyname(const char* name, int af, struct hostent* result,
2551
2937
  }
2552
2938
  hostent* retval = 0;
2553
2939
  int error = 0;
2554
- error_wrapper(::gethostbyname_r(name, result,
2555
- buffer, buflength, &retval, &error), ec);
2940
+ clear_last_error();
2941
+ ::gethostbyname_r(name, result, buffer, buflength, &retval, &error);
2942
+ get_last_error(ec, true);
2556
2943
  if (error)
2557
2944
  ec = translate_netdb_error(error);
2558
2945
  return retval;
@@ -3268,7 +3655,7 @@ inline asio::error_code getnameinfo_emulation(
3268
3655
  }
3269
3656
  }
3270
3657
 
3271
- ec = asio::error_code();
3658
+ ec.assign(0, ec.category());
3272
3659
  return ec;
3273
3660
  }
3274
3661