forked from boostorg/beast
Replace BOOST_ASIO_INITFN_RESULT_TYPE with BOOST_ASIO_INITFN_AUTO_RESULT_TYPE
asio::deferred doesn't work with BOOST_ASIO_INITFN_RESULT_TYPE Fixes #2727.
This commit is contained in:
committed by
Mohammad Nejati
parent
35d533299c
commit
45d4f7f306
@@ -1298,7 +1298,7 @@ public:
|
||||
resolve_results.begin()->endpoint(),
|
||||
net::use_awaitable))>);
|
||||
|
||||
auto comparison_function = [](error_code&, net::ip::tcp::endpoint) { return true; };
|
||||
auto comparison_function = [](error_code const&, net::ip::tcp::endpoint) { return true; };
|
||||
|
||||
static_assert(std::is_same_v<
|
||||
net::awaitable<net::ip::tcp::resolver::results_type::const_iterator>, decltype(
|
||||
|
||||
@@ -23,6 +23,7 @@ add_executable (tests-beast-http
|
||||
basic_parser.cpp
|
||||
buffer_body.cpp
|
||||
chunk_encode.cpp
|
||||
deferred.cpp
|
||||
dynamic_body.cpp
|
||||
empty_body.cpp
|
||||
error.cpp
|
||||
|
||||
@@ -14,6 +14,7 @@ local SOURCES =
|
||||
basic_parser.cpp
|
||||
buffer_body.cpp
|
||||
chunk_encode.cpp
|
||||
deferred.cpp
|
||||
dynamic_body.cpp
|
||||
error.cpp
|
||||
field.cpp
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright (c) 2023 Mohammad Nejati
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/asio/deferred.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/beast/http.hpp>
|
||||
|
||||
using namespace boost;
|
||||
namespace http = boost::beast::http;
|
||||
|
||||
#if !defined(BOOST_NO_CXX14)
|
||||
|
||||
// just compile this.
|
||||
void test_deferred_for_http(
|
||||
asio::ip::tcp::socket & stream,
|
||||
beast::flat_static_buffer_base & buf,
|
||||
http::basic_parser<true> & parser,
|
||||
http::serializer<true, http::empty_body> & ser,
|
||||
http::message<false, http::empty_body> & msg)
|
||||
{
|
||||
http::async_read(stream, buf, parser, asio::deferred);
|
||||
http::async_read(stream, buf, msg, asio::deferred);
|
||||
http::async_read_some(stream, buf, parser, asio::deferred);
|
||||
http::async_read_header(stream, buf, parser, asio::deferred);
|
||||
|
||||
http::async_write(stream, ser, asio::deferred);
|
||||
http::async_write(stream, msg, asio::deferred);
|
||||
http::async_write_header(stream, ser, asio::deferred);
|
||||
http::async_write_some(stream, ser, asio::deferred);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@ add_executable (tests-beast-websocket
|
||||
accept.cpp
|
||||
cancel.cpp
|
||||
close.cpp
|
||||
deferred.cpp
|
||||
error.cpp
|
||||
frame.cpp
|
||||
handshake.cpp
|
||||
|
||||
@@ -15,6 +15,7 @@ local SOURCES =
|
||||
accept.cpp
|
||||
cancel.cpp
|
||||
close.cpp
|
||||
deferred.cpp
|
||||
error.cpp
|
||||
frame.cpp
|
||||
handshake.cpp
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Copyright (c) 2023 Mohammad Nejati
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/asio/deferred.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
|
||||
using namespace boost;
|
||||
namespace websocket = boost::beast::websocket;
|
||||
|
||||
#if !defined(BOOST_NO_CXX14)
|
||||
|
||||
// just compile this.
|
||||
void test_deferred_for_websocket(
|
||||
websocket::stream<asio::ip::tcp::socket> & stream,
|
||||
beast::flat_static_buffer_base & buf,
|
||||
beast::http::request<beast::http::empty_body> & req,
|
||||
websocket::response_type & res)
|
||||
{
|
||||
stream.async_accept(asio::deferred);
|
||||
stream.async_accept(asio::const_buffer(), asio::deferred);
|
||||
stream.async_accept(req, asio::deferred);
|
||||
stream.async_close(websocket::close_code::bad_payload, asio::deferred);
|
||||
|
||||
stream.async_handshake("", "/", asio::deferred);
|
||||
stream.async_handshake(res, "", "/", asio::deferred);
|
||||
|
||||
stream.async_ping(websocket::ping_data{}, asio::deferred);
|
||||
stream.async_pong(websocket::ping_data{}, asio::deferred);
|
||||
|
||||
stream.async_read(buf, asio::deferred);
|
||||
stream.async_read_some(buf.data(), asio::deferred);
|
||||
|
||||
stream.async_write(buf.cdata(), asio::deferred);
|
||||
stream.async_write_some(true, buf.cdata(), asio::deferred);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user