forked from boostorg/beast
websockets: Count pings from server as activity for idle_timeout
If the stream is receiving control packets like ping, don't count it as idle. This means you can enable `timeout_opt.keep_alive_ping` on only one side to get heartbeat. Make tests that verify current behaviour. Update documentation to match changes in PR #2718. Addresses issue #2716
This commit is contained in:
1 parent
84115e5b13
commit
f9387fda71
5 files changed
+89
-12
No files matched your search
@@ -439,12 +439,8 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
if(timeout_opt.idle_timeout != none())
|
||||
{
|
||||
idle_counter = 0;
|
||||
if(timeout_opt.keep_alive_pings)
|
||||
timer.expires_after(
|
||||
timeout_opt.idle_timeout / 2);
|
||||
else
|
||||
timer.expires_after(
|
||||
timeout_opt.idle_timeout);
|
||||
timer.expires_after(
|
||||
timeout_opt.idle_timeout / 2);
|
||||
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
@@ -569,9 +565,9 @@ private:
|
||||
if(impl.timeout_opt.idle_timeout == none())
|
||||
return;
|
||||
|
||||
if( impl.timeout_opt.keep_alive_pings &&
|
||||
impl.idle_counter < 1)
|
||||
if( impl.idle_counter < 1 )
|
||||
{
|
||||
if( impl.timeout_opt.keep_alive_pings )
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
|
||||
Reference in new issue
Block a user