You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.4 KiB

  1. From c769c9238ad62178f506038178714a1c35aa2769 Mon Sep 17 00:00:00 2001
  2. From: Stefan Floeren <42731906+stefan-floeren@users.noreply.github.com>
  3. Date: Tue, 16 Apr 2019 08:38:01 +0200
  4. Subject: [PATCH 1/4] Replace make_shared with new in some cases
  5. Replace make_shared for asio types that take a lib::ref as a parameter.
  6. This should fix the ASIO change (boostorg/asio@59066d8) for 1.70,
  7. while keeping it backwards compatible to older boost versions.
  8. diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp
  9. index 60f88a7..1ccda8f 100644
  10. --- a/websocketpp/transport/asio/connection.hpp
  11. +++ b/websocketpp/transport/asio/connection.hpp
  12. @@ -311,9 +311,10 @@ public:
  13. * needed.
  14. */
  15. timer_ptr set_timer(long duration, timer_handler callback) {
  16. - timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
  17. - lib::ref(*m_io_service),
  18. - lib::asio::milliseconds(duration)
  19. + timer_ptr new_timer(
  20. + new lib::asio::steady_timer(
  21. + *m_io_service,
  22. + lib::asio::milliseconds(duration))
  23. );
  24. if (config::enable_multithreading) {
  25. diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp
  26. index ddab2c7..4b719a9 100644
  27. --- a/websocketpp/transport/asio/endpoint.hpp
  28. +++ b/websocketpp/transport/asio/endpoint.hpp
  29. @@ -195,8 +195,7 @@ public:
  30. m_io_service = ptr;
  31. m_external_io_service = true;
  32. - m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
  33. - lib::ref(*m_io_service));
  34. + m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
  35. m_state = READY;
  36. ec = lib::error_code();
  37. diff --git a/websocketpp/transport/asio/security/none.hpp b/websocketpp/transport/asio/security/none.hpp
  38. index 5c8293d..6c7d352 100644
  39. --- a/websocketpp/transport/asio/security/none.hpp
  40. +++ b/websocketpp/transport/asio/security/none.hpp
  41. @@ -168,8 +168,7 @@ protected:
  42. return socket::make_error_code(socket::error::invalid_state);
  43. }
  44. - m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
  45. - lib::ref(*service));
  46. + m_socket.reset(new lib::asio::ip::tcp::socket(*service));
  47. if (m_socket_init_handler) {
  48. m_socket_init_handler(m_hdl, *m_socket);
  49. diff --git a/websocketpp/transport/asio/security/tls.hpp b/websocketpp/transport/asio/security/tls.hpp
  50. index c76fd9a..04ac379 100644
  51. --- a/websocketpp/transport/asio/security/tls.hpp
  52. +++ b/websocketpp/transport/asio/security/tls.hpp
  53. @@ -193,8 +193,7 @@ protected:
  54. if (!m_context) {
  55. return socket::make_error_code(socket::error::invalid_tls_context);
  56. }
  57. - m_socket = lib::make_shared<socket_type>(
  58. - _WEBSOCKETPP_REF(*service),lib::ref(*m_context));
  59. + m_socket.reset(new socket_type(*service, *m_context));
  60. if (m_socket_init_handler) {
  61. m_socket_init_handler(m_hdl, get_socket());
  62. diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp
  63. index 1ccda8f..57dda74 100644
  64. --- a/websocketpp/transport/asio/connection.hpp
  65. +++ b/websocketpp/transport/asio/connection.hpp
  66. @@ -462,8 +462,7 @@ protected:
  67. m_io_service = io_service;
  68. if (config::enable_multithreading) {
  69. - m_strand = lib::make_shared<lib::asio::io_service::strand>(
  70. - lib::ref(*io_service));
  71. + m_strand.reset(new lib::asio::io_service::strand(*io_service));
  72. }
  73. lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
  74. diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp
  75. index 4b719a9..94509ad 100644
  76. --- a/websocketpp/transport/asio/endpoint.hpp
  77. +++ b/websocketpp/transport/asio/endpoint.hpp
  78. @@ -687,9 +687,7 @@ public:
  79. * @since 0.3.0
  80. */
  81. void start_perpetual() {
  82. - m_work = lib::make_shared<lib::asio::io_service::work>(
  83. - lib::ref(*m_io_service)
  84. - );
  85. + m_work.reset(new lib::asio::io_service::work(*m_io_service));
  86. }
  87. /// Clears the endpoint's perpetual flag, allowing it to exit when empty
  88. @@ -853,8 +851,7 @@ protected:
  89. // Create a resolver
  90. if (!m_resolver) {
  91. - m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
  92. - lib::ref(*m_io_service));
  93. + m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
  94. }
  95. tcon->set_uri(u);
  96. --
  97. 2.26.1