beast
beast copied to clipboard
Added cancellation_slot tests to http.
Validating & implementing support for asio::cancellation_slot.
Implements #2325
The basic_stream functions are all inheriting async_base and are used in the main op. This will work fine with cancellation.
It was mainly the wrappers (bind_front) and the write_op composed op that needed some help.
This will need more validation work and there are a few gaps, mainly when the websockets does a post. that's technically a race where we might miss a cancellation. I'll need some help on it's composition to figure that out though.
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
Codecov Report
Merging #2512 (f2e85a8) into develop (5db6da9) will increase coverage by
0.00%. The diff coverage is83.43%.
Additional details and impacted files
@@ Coverage Diff @@
## develop #2512 +/- ##
========================================
Coverage 94.69% 94.70%
========================================
Files 153 154 +1
Lines 11928 12019 +91
========================================
+ Hits 11295 11382 +87
- Misses 633 637 +4
| Impacted Files | Coverage Δ | |
|---|---|---|
| include/boost/beast/core/basic_stream.hpp | 100.00% <ø> (ø) |
|
| include/boost/beast/core/detect_ssl.hpp | 93.75% <0.00%> (ø) |
|
| include/boost/beast/core/saved_handler.hpp | 100.00% <ø> (ø) |
|
| include/boost/beast/http/buffer_body.hpp | 86.36% <0.00%> (ø) |
|
| include/boost/beast/http/empty_body.hpp | 71.42% <0.00%> (ø) |
|
| include/boost/beast/http/parser.hpp | 81.96% <0.00%> (ø) |
|
| include/boost/beast/http/string_body.hpp | 89.47% <0.00%> (ø) |
|
| include/boost/beast/websocket/impl/ssl.hpp | 0.00% <ø> (ø) |
|
| include/boost/beast/websocket/stream.hpp | 100.00% <ø> (ø) |
|
| include/boost/beast/websocket/impl/handshake.hpp | 96.72% <33.33%> (ø) |
|
| ... and 26 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 0bf3d97...f2e85a8. Read the comment docs.
-
does each handler need a cancellation slot? why not put it on the stream (or is that nonsensical)?
-
will this be squashed
- This is per-op cancellation, not stream cancellation
- Yes.
@madmongo1 can you review the current version?
individual ops cannot be reliably canceled though, and there's no way to know what state the stream is in afterwards
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
Cancelling http::async_read is currently unreliable, because the cancellation state of a pr is protected - probably just a mistake in asio, will make a pr.
Are you going to squash this?
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
@sehe @madmongo1 I think it's ready, so I could use another review, since this is stuff can be critical.
Note to self: document which op supports what kind of cancellation. Most likely only terminal everywhere. Reference:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/ssl/stream.hpp#L567
Is it possible to squash all the commits that relate to cancelation?
Note to self: Verify partial cancellation doesn't break the websocket::async_read_some and websocket::async_writes_some
Sockets .async_read_some and async_write_some can be cancelled partially.
https://www.boost.org/doc/libs/1_80_0/doc/html/boost_asio/reference/basic_stream_socket/async_read_some.html
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
wrong cancellation type issue & docs are done. Should be ready to merge.
An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html
An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html
An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html
An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html
Timeline tracing charts: https://2512.beast.tracing.cppalliance.org/index.html
An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html