| 81 | // re-construct and re-start it if the operation fails. |
| 82 | template <class S, class R> |
| 83 | struct _op |
| 84 | { |
| 85 | S s_; |
| 86 | R r_; |
| 87 | std::optional<stdexec::connect_result_t<S&, _retry_receiver<S, R>>> o_; |
| 88 | |
| 89 | _op(S s, R r) |
| 90 | : s_(static_cast<S&&>(s)) |
| 91 | , r_(static_cast<R&&>(r)) |
| 92 | , o_{_connect()} |
| 93 | {} |
| 94 | |
| 95 | _op(_op&&) = delete; |
| 96 | |
| 97 | auto _connect() noexcept |
| 98 | { |
| 99 | return _conv{[this] { return stdexec::connect(s_, _retry_receiver<S, R>{this}); }}; |
| 100 | } |
| 101 | |
| 102 | void _retry() noexcept |
| 103 | { |
| 104 | STDEXEC_TRY |
| 105 | { |
| 106 | o_.emplace(_connect()); // potentially throwing |
| 107 | stdexec::start(*o_); |
| 108 | } |
| 109 | STDEXEC_CATCH_ALL |
| 110 | { |
| 111 | stdexec::set_error(static_cast<R&&>(r_), std::current_exception()); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void start() & noexcept |
| 116 | { |
| 117 | stdexec::start(*o_); |
| 118 | } |
| 119 | }; |
| 120 | |
| 121 | template <class S> |