profile
viewpoint
Richard Hodges madmongo1 Sierra Global Experts Andorra https://www.sierraglobalexperts.com/ Software developer of 30 years, ex helicopter pilot, small business dabbler, derivatives trader. A Maintainer of Boost.Beast

boostorg/beast 3229

HTTP and WebSocket built on Boost.Asio in C++11

boostorg/json 254

A C++11 or library for parsing and serializing JSON to and from a DOM container in memory.

laudrup/boost-wintls 22

Native Windows TLS stream wrapper for use with boost::asio

boostorg/docca 9

Boost.Book XSLT C++ documentation system

dlinten/Simple-Web-Server 0

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

dlinten/Simple-WebSocket-Server 0

A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++.

madmongo1/accumulators 0

An awesome library from Boost

issue commentboostorg/beast

Client should close with 1010 if permessage-deflate offer is rejected

I think a good start would be to set up a test that sets up the above scenario. Then place a breakpoint in the code for the async operation for async_handshake and the sync operation for handshake.

vinniefalco

comment created time in 3 days

pull request commentboostorg/beast

codecov.yml file - ignore dirs

Do you want this merged into develop?

sdarwin

comment created time in 3 days

push eventmadmongo1/blog-new-year-2021

Sergei Ilinykh

commit sha 449ae54400bcc06450d9b90518f3f9a67a5afeed

Return IO failure even if tcp shutdown succeeded

view details

Richard Hodges

commit sha 3ae8258ab83d1ea055f6373de6f05956ad1014c7

Merge pull request #8 from Ri0n/master Return IO failure even if tcp shutdown succeeded

view details

push time in 7 days

PR merged madmongo1/blog-new-year-2021

Return IO failure even if tcp shutdown succeeded

successful shutdown can hide the error that just happened. This results in false-successful result.

+8 -1

0 comment

1 changed file

Ri0n

pr closed time in 7 days

PullRequestReviewEvent

push eventmadmongo1/blog-new-year-2021

Sergei Ilinykh

commit sha 046cee3bf54adf4f2e8e60b7fceecb9f45f2302d

Reformat code with clang-format-13

view details

Sergei Ilinykh

commit sha a666256ad9ffbe5a239cc56570098391d0b95987

Convert into library and example tools

view details

Sergei Ilinykh

commit sha f236bd79d4d5f9d6e8d32b45b5ae4a67a96f2027

Added a readme file

view details

Sergei Ilinykh

commit sha ac5b24533ee4ba9e1caef2a41c167ce7b37d1a43

Allow multiple urls on command line

view details

Sergey Ilinykh

commit sha ac28a6fba73554fb0135e49d5b8bfcd5353832fc

Update README.md

view details

Sergei Ilinykh

commit sha fd67b8c2f78ec2e6461d3546736f4b5b1189d713

Updated installation procedure

view details

Sergei Ilinykh

commit sha e4932ec137d6ebcb60f3e37af23deca3a96e4b2d

Added swp files to gitignore

view details

Richard Hodges

commit sha f6b616089f84c623716c9b64189eb12b300be394

Merge pull request #7 from Ri0n/master Convert all the code into a library

view details

push time in 7 days

PR merged madmongo1/blog-new-year-2021

Convert all the code into a library

Also add some options to build just library or also demo tools.

+286 -89

0 comment

23 changed files

Ri0n

pr closed time in 7 days

MemberEvent

push eventmadmongo1/boost_connector

Richard Hodges

commit sha 4ed8abad36c3335089c0cf40623c74481a60e435

wip

view details

Richard Hodges

commit sha b598df45870731d2b9d3f79ff37dd51834d3c827

wip

view details

Richard Hodges

commit sha 521c189774684eff740525d8a7f301a5ce43744f

property_value working

view details

Richard Hodges

commit sha e2602011c2fc1a7c70a808666d2853d2471a3262

rename move to move_construct

view details

Richard Hodges

commit sha 59b5e4aa5fd724275ce410ab74417a6a44ec563f

property_value code-complete

view details

Richard Hodges

commit sha 550394ff7c9fe1caf99447f2b4a2531a20048b60

add property_map tests

view details

Richard Hodges

commit sha 3cd4ccc09d61bcb9a9c2554cf29e83afe31c23ae

property_map x

view details

Richard Hodges

commit sha 402b596703a5d649b2735387714e3e5ae2cc7ea2

info

view details

Richard Hodges

commit sha d99441743d8475a71c98ca7b563d11fe94f27ec4

sort-of-fix construction rules of property_value

view details

Richard Hodges

commit sha 64e968a66f4ab3196d54f07894973eee8675e766

self-configuring examples

view details

Richard Hodges

commit sha cc25125c1a52fe51b6fedd19a2cf6d625f580b31

json path search

view details

Richard Hodges

commit sha 497a7286bd0c03747d82d6b754357a08c07a00e9

json-based key

view details

Richard Hodges

commit sha 4c51c0074a7604acae685365cdcd0258d9a32f8e

Add mutable_key and immutable_key

view details

push time in 12 days

push eventmadmongo1/boost_connector

Richard Hodges

commit sha 4c51c0074a7604acae685365cdcd0258d9a32f8e

Add mutable_key and immutable_key

view details

push time in 12 days

push eventmadmongo1/beast

Richard Hodges

commit sha 79e6dbd0e9792e3c36affdbc891ce5fdcc44e801

Add tests-beast-all target

view details

Richard Hodges

commit sha 8f877a8bb0654016a23c7c793880454f020e4fba

Fix warning in test_handler

view details

push time in 13 days

PR opened boostorg/beast

Add individual tests to CMake workflow
+61 -0

0 comment

9 changed files

pr created time in 13 days

create barnchmadmongo1/beast

branch : individual_tests

created branch time in 13 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

No because that that point you're not in a coroutine.

C++ coroutines are not functions - they are sequences of function calls with attached state. They just happen to look like functions in the source code. This is because unlike boost.context-based coroutines, they are stackless.

The upshot of this is that we essentially have two distinct "languages" that share the same syntax. Coroutines can call functions and therefore switch back into C++, but functions cannot directly "call" coroutines for effect, because all calling a coroutine does is prepare it and return the awaitable. The work starts happening when you co_await the awaitable, and co_await can only appear in a coroutine.

brjoha

comment created time in 13 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

https://github.com/beast-issues/2347/blob/3134a4304003f92a54c684381b3b40d68a915fd6/main.cpp#L121

Here you go - a working example to get us started.

brjoha

comment created time in 14 days

create barnchbeast-issues/2347

branch : master

created branch time in 14 days

created repositorybeast-issues/2347

Issue 2347

created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

ok no worries.

brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

What is a good example of asio::some_async_op ?

brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

In that case you must implement it as a native asio template function, which invokes composed operation. If you can be more specific about that "pre-processing" and "post-processing" involves and what the expected signature of the completion handler should be, I'm happy to write an example for you.

At the moment I am assuming that the completion handler signature is void(error_code, bool) ?

brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

You have a number of options, you can return a tuple or you can pass by reference.

Here's one way:

asio::awaitable< std::tuple<error_code, bool> > 
my_async_op() 
{
   // ... pre-processing ...
   boost::system::error_code ec;
   co_await asio::some_async_op(asio::redirect_error(asio::use_awaitable, ec);
   // ... post-processing ...
   co_return std::make_tuple(ec, true);
}
brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

For async_entry() to await my_async_op(), it needs to accept a handler argument does it not?

No, my_async_op is already a coroutine because it contains a co_await and/or co_return. So there's no need to tell it again that it's a coroutine by passing another use_awaitable token into it.

brjoha

comment created time in 14 days

issue commentboostorg/beast

How to determine message size (body + headers) for async_write progress callbacks

Calling prepare_payload on the request object will have the following effect:

This function will adjust the Content-Length and Transfer-Encoding field values based on the properties of the body.

Implementing the write in terms of http::async_write_header and http::async_write_some, as you have done with the read should then give you what you need.

That's probably the simplest option at this stage.

amirfi95

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

So a possible implementation of your function might be:

boost::asio::awaitable<bool> 
my_async_op(boost::system::error_code& ec) {
    using boost::asio::redirect_error;
    using boost::asio::use_awaitable;

    co_return co_await boost::asio::some_async_op(redirect_error(use_awaitable, ec));
}

But you may as well not bother with the function in this case. Simply call the async operation directly from your code:

    using boost::asio::experimental::as_tuple;
    
    auto [ec, yesno] = co_await boost::asio::some_async_op(as_tuple(use_awaitable));

brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

async_initiate is the general purpose mechanism for turning a completion token into a completion handler and then optionally delivering the result of calling that handler to some kind of promise.

Since you are have already settled on coroutines as your promise type, you can write your code in terms of coroutines. There is no need to involve async_result unless you are writing your own async operations that are designed to work with any token type.

Note that if you need to do this, the modern way is to use the asio::async_initiate<> template function.

brjoha

comment created time in 14 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

The equivalent function would be:

co_await boost::asio::some_async_op(boost::asio::use_awaitable);
// if you get here, implies true. Otherwise, exception.
brjoha

comment created time in 15 days

issue commentboostorg/beast

Off-topic question on chained C++20 coroutines

There are a couple of misunderstandings demonstrated by the code. Do you have a repo where you can demonstrate what you are trying to achieve? maybe write it with boost coroutines and I’ll help you translate it

brjoha

comment created time in 15 days

issue commentboostorg/beast

Performance over different boost version

does it mean I need to explicitly name the executor in net::awaitable's as well?

Yes, once you start specifying a specific executor model it becomes viral.

Is there a compile-time or run-time mechanism to change the default executor (system wide) rather than defining my own using types that name my preferred executor?

Unhappily no. I tend to write my own config.hpp file which defines the types I need for my program's namespace.

shuras109

comment created time in 16 days

issue commentboostorg/beast

Performance over different boost version

Getting maximum performance from Asio is an art form in itself. Using named executor types is a first step. Then there is the use of custom allocators. If your server has a fixed maximum number of connections for example, you can preallocate all memory required. Another thing people do is use a kernel bypass network library, use a single thread with affinity to a dedicated processor, configure the io context to use no mutexes and use io_context poll() rather than run() (this will cause your cpu to hot spin)

shuras109

comment created time in 16 days

issue commentmadmongo1/blog-new-year-2021

How to get return value outside visit function?

This program is written in terms of asynchronous coroutines.

sukeyisme

comment created time in 18 days

more