Skip to content

Commit

Permalink
Merge branch 'boostorg:develop' into zig-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane authored Oct 16, 2023
2 parents 7eee819 + 19976ff commit a806e05
Show file tree
Hide file tree
Showing 29 changed files with 511 additions and 240 deletions.
51 changes: 33 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 349:

* Added support for `immediate_executor`. (#2672)
* Replaced `BOOST_ASIO_INITFN_RESULT_TYPE` with `BOOST_ASIO_INITFN_AUTO_RES`. (#2669)
* Updated license info for `work_guard`. (#2664)
* Corrected handler requirements of ping/pong. (#2663)
* Improved Drone caching. (#2655)
* `server-flex-awaitable` example now resets parser. (#2660)
* Updated openssl version to 1.1.1.2100 for x86. (#2659)
* Set minimum gcc version to 5.0. (#2658)
* Introduced self-hosted GitHub actions runners. (#2656)
* Minor documentation fixes and updates.

--------------------------------------------------------------------------------

Version 348:

* multiple CI fixes
Expand Down Expand Up @@ -180,9 +195,9 @@ Version 324:
Version 323:

* Fix clang-cl UTF8 path handling for `file_win32`.
* Fix clang-cl UTF8 path handling for `file_stdio`.
* Fix clang-cl UTF8 path handling for `file_stdio`.
* Add individual tests to CMake workflow.
* Update CI to include gcc 11, clang 12, msvc 14.3.
* Update CI to include gcc 11, clang 12, msvc 14.3.
* Update code coverage settings.

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -361,10 +376,10 @@ Version 301:
API Changes:

* Previously, `teardown` and `async_teardown` of a websocket connection over SSL
would only shut down the SSL layer, leaving the TCP layer connected. Now the
SSL teardown will tear down both the SSL and TCP layers, cleanly shutting down
would only shut down the SSL layer, leaving the TCP layer connected. Now the
SSL teardown will tear down both the SSL and TCP layers, cleanly shutting down
the TCP connection and closing the socket.
Should the client expect the TCP socket to remain connected, users will need to
Should the client expect the TCP socket to remain connected, users will need to
re-engineer their code.

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -400,15 +415,15 @@ Version 297:

API Changes:

* `string_param`, which was previously the argument type when setting field values
has been replaced by `string_view`. Because of this, it is no longer possible to
set message field values directly as integrals.
* `string_param`, which was previously the argument type when setting field values
has been replaced by `string_view`. Because of this, it is no longer possible to
set message field values directly as integrals.

Users are required to convert numeric arguments to a string type prior to calling
Users are required to convert numeric arguments to a string type prior to calling
`fields::set` et. al.

Beast provides the non-allocating `to_static_string()` function for this purpose.

To set Content-Length field manually, call `message::content_length`.

--------------------------------------------------------------------------------
Expand All @@ -429,7 +444,7 @@ Version 296:
API Changes:

* The file `core/buffers_adapter.hpp` has been removed along with the deprecated
alias typename `buffers_adapter`. Affected programs should use
alias typename `buffers_adapter`. Affected programs should use
`core/buffers_adapator.hpp` and the type `buffers_adaptor`.

* The error code enum `invalid_code_lenths` was a synonym of `invalid_code_lengths`.
Expand All @@ -439,7 +454,7 @@ API Changes:
the type trait `is_completion_handler`. Beast uses the CompletionHandler correctness
checks provided by Asio. In a c++20 environment, these convert to concept checks.

* The `reset` function has been removed from `flat_static_buffer`. Use the
* The `reset` function has been removed from `flat_static_buffer`. Use the
`clear` function instead.

* Code that depends on `mutable_data_type` should be refactored to use
Expand All @@ -450,7 +465,7 @@ API Changes:
- `multi_buffer`
- `static_buffer`

* handler_ptr has been removed. Users should use net::bind_handler and/or
* handler_ptr has been removed. Users should use net::bind_handler and/or
bind_front_handler instead.

* websocket::role_type has been removed. Users should use beast::role_type instead.
Expand All @@ -465,7 +480,7 @@ Programs still using these names should be refactored to use the `decorator` fea
the remaining handshake and accept functions.

* The macro BOOST_BEAST_NO_DEPRECATED will no longer be noticed by Beast. The only way to
enable deprecated functionality is now the macro BOOST_BEAST_ALLOW_DEPRECATED which is
enable deprecated functionality is now the macro BOOST_BEAST_ALLOW_DEPRECATED which is
undefined by default. That is, all deprecated behaviour is disabled by default.

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -507,7 +522,7 @@ by the HTTP parser:
- http::async_read_header
- http::async_read_some

As of now, the `bytes_transferred` return value will indicate the number of bytes
As of now, the `bytes_transferred` return value will indicate the number of bytes
consumed by the parser when parsing an http message.

Actions Required:
Expand Down Expand Up @@ -535,7 +550,7 @@ Behaviour Changes:
Version 292:

* Fix compile errors on Visual Studio with /std:c++latest
* Fix standalone compilation error with std::string_view
* Fix standalone compilation error with std::string_view
* OpenSSL 1.0.2 or later is required
* Fix c++20 deprecation warning in span_body

Expand Down Expand Up @@ -604,7 +619,7 @@ API Changes:
- flat_static_buffer
- multi_buffer
- static_buffer

* Nested mutable_data_type in Beast dynamic buffers is deprecated:

Changes Required:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ endfunction()
#
#-------------------------------------------------------------------------------

project (Beast VERSION 348)
project (Beast VERSION 349)

set_property (GLOBAL PROPERTY USE_FOLDERS ON)
option (Beast_BUILD_EXAMPLES "Build examples" ON)
Expand Down
24 changes: 14 additions & 10 deletions include/boost/beast/_experimental/http/icy_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,13 @@ class icy_stream
std::size_t bytes_transferred // Number of bytes read.
);
@endcode
Regardless of whether the asynchronous operation completes
immediately or not, the handler will not be invoked from within
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
If the handler has an associated immediate executor,
an immediate completion will be dispatched to it.
Otherwise, the handler will not be invoked from within
this function. Invocation of the handler will be performed
by dispatching to the immediate executor. If no
immediate executor is specified, this is equivalent
to using `net::post`.
@note The `async_read_some` operation may not read all of the requested number of
bytes. Consider using the function `net::async_read` if you need
to ensure that the requested amount of data is read before the asynchronous
Expand Down Expand Up @@ -295,11 +297,13 @@ class icy_stream
std::size_t bytes_transferred // Number of bytes written.
);
@endcode
Regardless of whether the asynchronous operation completes
immediately or not, the handler will not be invoked from within
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
If the handler has an associated immediate executor,
an immediate completion will be dispatched to it.
Otherwise, the handler will not be invoked from within
this function. Invocation of the handler will be performed
by dispatching to the immediate executor. If no
immediate executor is specified, this is equivalent
to using `net::post`.
@note The `async_write_some` operation may not transmit all of the data to
the peer. Consider using the function `net::async_write` if you need
to ensure that all data is written before the asynchronous operation completes.
Expand Down
71 changes: 71 additions & 0 deletions include/boost/beast/_experimental/test/immediate_executor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// Copyright (c) 2023 Klemens Morgenstern (klemens.morgenstern@gmx.net)
//
// 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)
//

#ifndef BOOST_BEAST_TEST_IMMEDIATE_EXECUTOR_HPP
#define BOOST_BEAST_TEST_IMMEDIATE_EXECUTOR_HPP

#include <boost/asio/any_io_executor.hpp>

namespace boost
{
namespace beast
{
namespace test
{

/** A immediate executor that directly invokes and counts how often that happened. */

class immediate_executor
{
std::size_t &count_;
public:
immediate_executor(std::size_t & count) noexcept : count_(count) {}

asio::execution_context &query(asio::execution::context_t) const
{
BOOST_ASSERT(false);
return *static_cast<asio::execution_context*>(nullptr);
}

constexpr static asio::execution::blocking_t
query(asio::execution::blocking_t) noexcept
{
return asio::execution::blocking_t::never_t{};
}

constexpr static asio::execution::relationship_t
query(asio::execution::relationship_t) noexcept
{
return asio::execution::relationship_t::fork_t{};
}
// this function takes the function F and runs it on the event loop.
template<class F>
void
execute(F f) const
{
count_++;
std::forward<F>(f)();
}

bool
operator==(immediate_executor const &other) const noexcept
{
return true;
}

bool
operator!=(immediate_executor const &other) const noexcept
{
return false;
}
};

}
}
}

#endif //BOOST_BEAST_TEST_IMMEDIATE_EXECUTOR_HPP
25 changes: 14 additions & 11 deletions include/boost/beast/_experimental/test/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
Expand Down Expand Up @@ -454,11 +453,13 @@ class basic_stream
std::size_t bytes_transferred // Number of bytes read.
);
@endcode
Regardless of whether the asynchronous operation completes
immediately or not, the handler will not be invoked from within
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
If the handler has an associated immediate executor,
an immediate completion will be dispatched to it.
Otherwise, the handler will not be invoked from within
this function. Invocation of the handler will be performed
by dispatching to the immediate executor. If no
immediate executor is specified, this is equivalent
to using `net::post`.
@note The `async_read_some` operation may not read all of the requested number of
bytes. Consider using the function `net::async_read` if you need
to ensure that the requested amount of data is read before the asynchronous
Expand Down Expand Up @@ -534,11 +535,13 @@ class basic_stream
std::size_t bytes_transferred // Number of bytes written.
);
@endcode
Regardless of whether the asynchronous operation completes
immediately or not, the handler will not be invoked from within
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
If the handler has an associated immediate executor,
an immediate completion will be dispatched to it.
Otherwise, the handler will not be invoked from within
this function. Invocation of the handler will be performed
by dispatching to the immediate executor. If no
immediate executor is specified, this is equivalent
to using `net::post`.
@note The `async_write_some` operation may not transmit all of the data to
the peer. Consider using the function `net::async_write` if you need
to ensure that all data is written before the asynchronous operation completes.
Expand Down
Loading

0 comments on commit a806e05

Please sign in to comment.