mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 06:15:24 +02:00
Squelch spurious websocket timer assert
This commit is contained in:
38
.travis.yml
38
.travis.yml
@@ -62,6 +62,25 @@ matrix:
|
|||||||
- libc++-dev
|
- libc++-dev
|
||||||
- libc++abi-dev
|
- libc++abi-dev
|
||||||
|
|
||||||
|
# GCC 5.0, Valgrind
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-5
|
||||||
|
env:
|
||||||
|
- VARIANT=beast_valgrind
|
||||||
|
- TOOLSET=gcc
|
||||||
|
- COMPILER=g++-5
|
||||||
|
- CXXSTD=11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
- libssl-dev
|
||||||
|
- valgrind
|
||||||
|
- *base_packages
|
||||||
|
sources:
|
||||||
|
- *base_sources
|
||||||
|
|
||||||
# Default g++
|
# Default g++
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++
|
compiler: g++
|
||||||
@@ -87,25 +106,6 @@ matrix:
|
|||||||
sources:
|
sources:
|
||||||
- *base_sources
|
- *base_sources
|
||||||
|
|
||||||
# GCC 5.0, Valgrind
|
|
||||||
- os: linux
|
|
||||||
dist: trusty
|
|
||||||
compiler: g++-5
|
|
||||||
env:
|
|
||||||
- VARIANT=beast_valgrind
|
|
||||||
- TOOLSET=gcc
|
|
||||||
- COMPILER=g++-5
|
|
||||||
- CXXSTD=11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-5
|
|
||||||
- libssl-dev
|
|
||||||
- valgrind
|
|
||||||
- *base_packages
|
|
||||||
sources:
|
|
||||||
- *base_sources
|
|
||||||
|
|
||||||
# Clang 3.8, UBasan
|
# Clang 3.8, UBasan
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-3.8
|
compiler: clang++-3.8
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
Version 273:
|
||||||
|
|
||||||
|
* Squelch spurious websocket timer assert
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 272:
|
Version 272:
|
||||||
|
|
||||||
* Add BEAST_THROWS
|
* Add BEAST_THROWS
|
||||||
|
@@ -451,7 +451,11 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(! is_timer_set());
|
// VFALCO This assert goes off when there's also
|
||||||
|
// a pending read with the timer set. The bigger
|
||||||
|
// fix is to give close its own timeout, instead
|
||||||
|
// of using the handshake timeout.
|
||||||
|
// BOOST_ASSERT(! is_timer_set());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||||
#include <boost/beast/core/flat_buffer.hpp>
|
#include <boost/beast/core/flat_buffer.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
|
#include <boost/asio/detached.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -85,10 +86,80 @@ struct timer_test : unit_test::suite
|
|||||||
test::run(ioc);
|
test::run(ioc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/boostorg/beast/issues/1729
|
||||||
|
void
|
||||||
|
testIssue1729()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
net::io_context ioc;
|
||||||
|
stream<tcp::socket> ws1(ioc);
|
||||||
|
stream<tcp::socket> ws2(ioc);
|
||||||
|
test::connect(ws1.next_layer(), ws2.next_layer());
|
||||||
|
|
||||||
|
ws1.set_option(websocket::stream_base::timeout{
|
||||||
|
std::chrono::milliseconds(50),
|
||||||
|
websocket::stream_base::none(),
|
||||||
|
false});
|
||||||
|
|
||||||
|
ws1.async_accept(net::detached);
|
||||||
|
ws2.async_handshake(
|
||||||
|
"localhost", "/", net::detached);
|
||||||
|
ioc.run();
|
||||||
|
ioc.restart();
|
||||||
|
|
||||||
|
flat_buffer b;
|
||||||
|
error_code ec1, ec2;
|
||||||
|
ws1.async_close({},
|
||||||
|
[&ec2](error_code ec)
|
||||||
|
{
|
||||||
|
ec2 = ec;
|
||||||
|
});
|
||||||
|
ioc.run();
|
||||||
|
BEAST_EXPECT(
|
||||||
|
ec1 == beast::error::timeout ||
|
||||||
|
ec2 == beast::error::timeout);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
net::io_context ioc;
|
||||||
|
stream<tcp::socket> ws1(ioc);
|
||||||
|
stream<tcp::socket> ws2(ioc);
|
||||||
|
test::connect(ws1.next_layer(), ws2.next_layer());
|
||||||
|
|
||||||
|
ws1.set_option(websocket::stream_base::timeout{
|
||||||
|
std::chrono::milliseconds(50),
|
||||||
|
websocket::stream_base::none(),
|
||||||
|
false});
|
||||||
|
|
||||||
|
ws1.async_accept(net::detached);
|
||||||
|
ws2.async_handshake(
|
||||||
|
"localhost", "/", net::detached);
|
||||||
|
ioc.run();
|
||||||
|
ioc.restart();
|
||||||
|
|
||||||
|
flat_buffer b;
|
||||||
|
error_code ec1, ec2;
|
||||||
|
ws1.async_read(b,
|
||||||
|
[&ec1](error_code ec, std::size_t)
|
||||||
|
{
|
||||||
|
ec1 = ec;
|
||||||
|
});
|
||||||
|
ws1.async_close({},
|
||||||
|
[&ec2](error_code ec)
|
||||||
|
{
|
||||||
|
ec2 = ec;
|
||||||
|
});
|
||||||
|
ioc.run();
|
||||||
|
BEAST_EXPECT(
|
||||||
|
ec1 == beast::error::timeout ||
|
||||||
|
ec2 == beast::error::timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
testIdlePing();
|
testIdlePing();
|
||||||
|
testIssue1729();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user