Report cancellation to a task's coroutine instead of throwing it (#5307) * Handle the result of sleep_for in the listener and socket loops The accept loop's pause, its wait for a free inbound slot and the socket's checkup interval ignored how their sleep ended. A cancelled sleep now ends each of them: wait_available_slots returns nano::io_result and the accept loop stops on its error, and the checkup stops before it advances its clock for an interval that did not pass. * Report cancellation to a task's coroutine instead of throwing it asio throws operation_aborted from the next co_await of a cancelled coroutine, so code after a wait had to expect a cancellation both as that wait's result and as an exception. nano::async::task now turns the throw off for its coroutine and everything it awaits. A cancelled task gets operation_aborted from the wait it was suspended in and true from nano::async::cancelled (), and has to return on its own. With the throw off, a cancellation only reaches the wait in progress when it arrives. One that arrives just after a wait completed, before the coroutine resumed, is not delivered to the next wait. sleep_for therefore looks for an earlier cancellation before it starts, and so does the listener's accept, which nothing else would end: stop joins the accept loop before it closes the acceptor. The new async tests cancel a task and check that its coroutine runs on past the cancelled wait, sees cancelled () and has a later sleep return at once; both fail without the change. The new tcp_listener test stops the node while a connect callback holds the listener's strand, so the cancellation arrives after the slot wait's timer expired; with the accept's check removed the stop stays in the accept until the test's rescue connection frees it. * Drop the handling of thrown cancellations from transport coroutines A task's coroutine no longer has a cancellation thrown into it, so the places that caught one have nothing left to catch. The try block around send_one in the channel's sending loop and the one around the listener's accept loop are removed, and nano::async::settle treats every exception as unexpected, a thrown operation_aborted included.
__________
Type: commit
Hash: fd2499d021a5ae58500aa777ea2c6795cc66d563
Created: yesterday
__________
gr0v1ty/nano-node:fd2499d021a5ae58500aa777ea2c6795cc66d563
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| 5n4pr_conf_10k_bintree | FAIL | 182 s | 77.0 s | Test log | Show |
| 5n4pr_conf_10k_change | FAIL | 269 s | 148.0 s | Test log | Show |
| 5n4pr_conf_change_dependant | PASS | 100 s | -5.0 s | GitHub job logs | - |
| 5n4pr_conf_change_independant | PASS | 232 s | 127.0 s | GitHub job logs | - |
| 5n4pr_conf_send_dependant | PASS | 118 s | 17.0 s | GitHub job logs | - |
| 5n4pr_conf_send_independant | PASS | 100 s | -10.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_bintree | FAIL | 198 s | 93.0 s | Test log | - |
| 5n4pr_rocks_10k_change | FAIL | 160 s | 3.0 s | Test log | - |