beast icon indicating copy to clipboard operation
beast copied to clipboard

Added cancellation_slot tests to http.

Open klemens-morgenstern opened this issue 3 years ago • 2 comments
trafficstars

Validating & implementing support for asio::cancellation_slot.

Implements #2325

klemens-morgenstern avatar Aug 31 '22 02:08 klemens-morgenstern

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.

klemens-morgenstern avatar Aug 31 '22 04:08 klemens-morgenstern

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.

klemens-morgenstern avatar Aug 31 '22 07:08 klemens-morgenstern

Codecov Report

Merging #2512 (f2e85a8) into develop (5db6da9) will increase coverage by 0.00%. The diff coverage is 83.43%.

Additional details and impacted files

Impacted file tree graph

@@           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 data Powered by Codecov. Last update 0bf3d97...f2e85a8. Read the comment docs.

codecov[bot] avatar Oct 02 '22 15:10 codecov[bot]

  1. does each handler need a cancellation slot? why not put it on the stream (or is that nonsensical)?

  2. will this be squashed

vinniefalco avatar Oct 02 '22 19:10 vinniefalco

  1. This is per-op cancellation, not stream cancellation
  2. Yes.

klemens-morgenstern avatar Oct 03 '22 01:10 klemens-morgenstern

@madmongo1 can you review the current version?

klemens-morgenstern avatar Oct 03 '22 01:10 klemens-morgenstern

individual ops cannot be reliably canceled though, and there's no way to know what state the stream is in afterwards

vinniefalco avatar Oct 03 '22 01:10 vinniefalco

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.

klemens-morgenstern avatar Oct 04 '22 04:10 klemens-morgenstern

Are you going to squash this?

vinniefalco avatar Oct 10 '22 14:10 vinniefalco

@sehe @madmongo1 I think it's ready, so I could use another review, since this is stuff can be critical.

klemens-morgenstern avatar Oct 11 '22 14:10 klemens-morgenstern

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

klemens-morgenstern avatar Oct 14 '22 05:10 klemens-morgenstern

Is it possible to squash all the commits that relate to cancelation?

madmongo1 avatar Oct 15 '22 13:10 madmongo1

Note to self: Verify partial cancellation doesn't break the websocket::async_read_some and websocket::async_writes_some

klemens-morgenstern avatar Oct 16 '22 07:10 klemens-morgenstern

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

klemens-morgenstern avatar Oct 16 '22 08:10 klemens-morgenstern

wrong cancellation type issue & docs are done. Should be ready to merge.

klemens-morgenstern avatar Oct 17 '22 17:10 klemens-morgenstern

An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html

cppalliance-bot avatar Oct 17 '22 17:10 cppalliance-bot

An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html

cppalliance-bot avatar Oct 17 '22 18:10 cppalliance-bot

An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html

cppalliance-bot avatar Oct 18 '22 03:10 cppalliance-bot

An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html

cppalliance-bot avatar Oct 18 '22 04:10 cppalliance-bot

An automated preview of the documentation is available at https://2512.beastdocs.prtest.cppalliance.org/libs/beast/doc/html/index.html

cppalliance-bot avatar Oct 27 '22 05:10 cppalliance-bot