diff --git a/CHANGELOG.md b/CHANGELOG.md index a7bc1908..937b2bdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 244: * Tidy up declval in some traits +* Fix websocket keep-alive ping expiration -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index 0c8834fb..ec5557c3 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -424,8 +424,12 @@ struct stream::impl_type if(timeout_opt.idle_timeout != none()) { idle_counter = 0; - timer.expires_after( - timeout_opt.idle_timeout); + if(timeout_opt.keep_alive_pings) + timer.expires_after( + timeout_opt.idle_timeout / 2); + else + timer.expires_after( + timeout_opt.idle_timeout); timer.async_wait( timeout_handler( ex, this->weak_from_this()));