From 83fc4209866a8644a58acb5e7f44cddbeabee048 Mon Sep 17 00:00:00 2001 From: Patrick Kwong Date: Wed, 24 Jun 2015 11:46:41 +0800 Subject: [PATCH 1/4] skip LOG in ping due to deadline_timer cancel --- src/internal/sio_client_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/sio_client_impl.cpp b/src/internal/sio_client_impl.cpp index 1f64ed22..704581fe 100644 --- a/src/internal/sio_client_impl.cpp +++ b/src/internal/sio_client_impl.cpp @@ -273,7 +273,8 @@ namespace sio { if(ec || m_con.expired()) { - LOG("ping exit,con is expired?"< Date: Wed, 24 Jun 2015 11:51:55 +0800 Subject: [PATCH 2/4] Revert "skip LOG in ping due to deadline_timer cancel" This reverts commit 83fc4209866a8644a58acb5e7f44cddbeabee048. --- src/internal/sio_client_impl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/internal/sio_client_impl.cpp b/src/internal/sio_client_impl.cpp index 704581fe..1f64ed22 100644 --- a/src/internal/sio_client_impl.cpp +++ b/src/internal/sio_client_impl.cpp @@ -273,8 +273,7 @@ namespace sio { if(ec || m_con.expired()) { - if (ec != boost::asio::error::operation_aborted) - LOG("ping exit,con is expired?"< Date: Wed, 24 Jun 2015 11:53:06 +0800 Subject: [PATCH 3/4] skip LOG in ping due to deadline_timer cancel --- src/internal/sio_client_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/sio_client_impl.cpp b/src/internal/sio_client_impl.cpp index 1f64ed22..9ce9b832 100644 --- a/src/internal/sio_client_impl.cpp +++ b/src/internal/sio_client_impl.cpp @@ -273,7 +273,8 @@ namespace sio { if(ec || m_con.expired()) { - LOG("ping exit,con is expired?"< Date: Thu, 25 Jun 2015 16:03:22 +0800 Subject: [PATCH 4/4] set m_client = NULL before remove_socket which will free itself --- src/sio_socket.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sio_socket.cpp b/src/sio_socket.cpp index 3dd53dd9..122dc5bd 100644 --- a/src/sio_socket.cpp +++ b/src/sio_socket.cpp @@ -316,6 +316,9 @@ namespace sio void socket::impl::on_close() { NULL_GUARD(m_client); + sio::client_impl *client = m_client; + m_client = NULL; + if(m_connection_timer) { m_connection_timer->cancel(); @@ -325,9 +328,8 @@ namespace sio while (!m_packet_queue.empty()) { m_packet_queue.pop(); } - m_client->on_socket_closed(m_nsp); - m_client->remove_socket(m_nsp); - m_client = NULL; + client->on_socket_closed(m_nsp); + client->remove_socket(m_nsp); } void socket::impl::on_open()