Update deprecated boost::asio::strand::wrap call (#256)

This commit is contained in:
Lee *!* Clagett
2026-05-23 11:22:48 -04:00
committed by Lee *!* Clagett
parent d86d25a7b6
commit 269584b592
+12 -10
View File
@@ -2124,17 +2124,19 @@ namespace lws
by the handler function), and therefore needs to be "wrapped" to
ensure thread safety. This also allows `resume` to be unwrapped.
DO NOT use `boost::asio::bind_executor` here as it doesn't create
a new callable like `wrap` does. */
a new callable like `wrap` does (which is deprecated, see dispatch
below). */
const auto& self = self_;
resumer = self->strand_.wrap(
[self, resume] (expect<copyable_slice> body) mutable
{
if (!body)
self->bad_request(body.error(), std::move(resume));
else
self->valid_request(std::move(body->value), std::move(resume));
}
);
resumer = [self, resume] (expect<copyable_slice> body) mutable
{
boost::asio::dispatch(self->strand_, [self, resume = std::move(resume), body = std::move(body)] () mutable
{
if (!body)
self->bad_request(body.error(), std::move(resume));
else
self->valid_request(std::move(body->value), std::move(resume));
});
};
}
MDEBUG("Running REST handler " << handler->name << " on " << self_.get());