Skip to content

Commit c769c92

Browse files
Replace make_shared with new in some cases
Replace make_shared for asio types that take a lib::ref as a parameter. This should fix the ASIO change (boostorg/asio@59066d8) for 1.70, while keeping it backwards compatible to older boost versions.
1 parent 2a885d5 commit c769c92

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

websocketpp/transport/asio/connection.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ class connection : public config::socket_type::socket_con_type {
311311
* needed.
312312
*/
313313
timer_ptr set_timer(long duration, timer_handler callback) {
314-
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
315-
lib::ref(*m_io_service),
316-
lib::asio::milliseconds(duration)
314+
timer_ptr new_timer(
315+
new lib::asio::steady_timer(
316+
*m_io_service,
317+
lib::asio::milliseconds(duration))
317318
);
318319

319320
if (config::enable_multithreading) {

websocketpp/transport/asio/endpoint.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ class endpoint : public config::socket_type {
195195

196196
m_io_service = ptr;
197197
m_external_io_service = true;
198-
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
199-
lib::ref(*m_io_service));
198+
m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
200199

201200
m_state = READY;
202201
ec = lib::error_code();

websocketpp/transport/asio/security/none.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ class connection : public lib::enable_shared_from_this<connection> {
168168
return socket::make_error_code(socket::error::invalid_state);
169169
}
170170

171-
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
172-
lib::ref(*service));
171+
m_socket.reset(new lib::asio::ip::tcp::socket(*service));
173172

174173
if (m_socket_init_handler) {
175174
m_socket_init_handler(m_hdl, *m_socket);

websocketpp/transport/asio/security/tls.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ class connection : public lib::enable_shared_from_this<connection> {
193193
if (!m_context) {
194194
return socket::make_error_code(socket::error::invalid_tls_context);
195195
}
196-
m_socket = lib::make_shared<socket_type>(
197-
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
196+
m_socket.reset(new socket_type(*service, *m_context));
198197

199198
if (m_socket_init_handler) {
200199
m_socket_init_handler(m_hdl, get_socket());

0 commit comments

Comments
 (0)