Skip to content

Commit 7a6770e

Browse files
author
Chris Grahn
committed
Change client_impl::send_impl() not to delay ping
client_impl::close_impl() only gets called when the user is closing the connection ("End by user"), when there is a handshake error, when the server sends a frame_close packet ("End by server"), or when there is a pong timeout. Before, in the case where send_impl() would continously get called with an interval less than client_impl::m_ping_interval, a disconnect due to network problems would never be detected because the ping would keep getting delayed, thus never allowing the pong timeout to happen. This fixes that by not delaying pings.
1 parent 725a8e0 commit 7a6770e

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/internal/sio_client_impl.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,6 @@ namespace sio
264264
{
265265
if(m_con_state == con_opened)
266266
{
267-
//delay the ping, since we already have message to send.
268-
boost::system::error_code timeout_ec;
269-
if(m_ping_timer)
270-
{
271-
m_ping_timer->expires_from_now(milliseconds(m_ping_interval),timeout_ec);
272-
m_ping_timer->async_wait(lib::bind(&client_impl::ping,this,lib::placeholders::_1));
273-
}
274267
lib::error_code ec;
275268
m_client.send(m_con,*payload_ptr,opcode,ec);
276269
if(ec)

0 commit comments

Comments
 (0)