-
Notifications
You must be signed in to change notification settings - Fork 748
fix reconnnect don`t effect #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@darrachequesne this pr is available, do you want to merge it ? |
| if (m_ping_timeout_timer) { | ||
| asio::error_code ec; | ||
| m_ping_timeout_timer->expires_from_now(milliseconds(m_ping_interval + m_ping_timeout),ec); | ||
| m_ping_timeout_timer->async_wait(std::bind(&client_impl::timeout_pong, this, std::placeholders::_1)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you recreating the timer here instead of just cancelling it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the on_ping event is received, the timer needs to be reset. If the on_ping event is not received before the next timeout, it is considered that the local network is disconnected.
| /*if(m_ping_timeout_timer) | ||
| { | ||
| m_ping_timeout_timer->cancel(); | ||
| m_ping_timeout_timer.reset(); | ||
| } | ||
| }*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't leave commented code. Just remove it.
| /*if(m_ping_timeout_timer) | |
| { | |
| m_ping_timeout_timer->cancel(); | |
| m_ping_timeout_timer.reset(); | |
| } | |
| }*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is my problem, thanks.
|
I have opened another pull request that also adresses this issue. |
|
Closing because #351 already fixed it. |
I found that when the network is disconnected, socket.io cannot detect that the network is disconnected and will not enable reconnect. So fix this problem.