forked from boostorg/beast
examples & tests use context instead of coroutine.
This commit is contained in:
committed by
Klemens Morgenstern
parent
1841a592d6
commit
99bceb5bff
@@ -19,5 +19,5 @@ exe websocket-client-coro-ssl :
|
||||
:
|
||||
<variant>coverage:<build>no
|
||||
<variant>ubasan:<build>no
|
||||
<library>/boost/coroutine//boost_coroutine
|
||||
<library>/boost/context//boost_context
|
||||
;
|
||||
|
||||
@@ -175,7 +175,18 @@ int main(int argc, char** argv)
|
||||
std::string(text),
|
||||
std::ref(ioc),
|
||||
std::ref(ctx),
|
||||
std::placeholders::_1));
|
||||
std::placeholders::_1),
|
||||
// on completion, spawn will call this function
|
||||
[](std::exception_ptr ex)
|
||||
{
|
||||
// if an exception occurred in the coroutine,
|
||||
// it's something critical, e.g. out of memory
|
||||
// we capture normal errors in the ec
|
||||
// so we just rethrow the exception here,
|
||||
// which will cause `ioc.run()` to throw
|
||||
if (ex)
|
||||
std::rethrow_exception(ex);
|
||||
});
|
||||
|
||||
// Run the I/O service. The call will return when
|
||||
// the socket is closed.
|
||||
|
||||
@@ -12,5 +12,5 @@ exe websocket-client-coro :
|
||||
:
|
||||
<variant>coverage:<build>no
|
||||
<variant>ubasan:<build>no
|
||||
<library>/boost/coroutine//boost_coroutine
|
||||
<library>/boost/context//boost_context
|
||||
;
|
||||
|
||||
@@ -143,7 +143,18 @@ int main(int argc, char** argv)
|
||||
std::string(port),
|
||||
std::string(text),
|
||||
std::ref(ioc),
|
||||
std::placeholders::_1));
|
||||
std::placeholders::_1),
|
||||
// on completion, spawn will call this function
|
||||
[](std::exception_ptr ex)
|
||||
{
|
||||
// if an exception occurred in the coroutine,
|
||||
// it's something critical, e.g. out of memory
|
||||
// we capture normal errors in the ec
|
||||
// so we just rethrow the exception here,
|
||||
// which will cause `ioc.run()` to throw
|
||||
if (ex)
|
||||
std::rethrow_exception(ex);
|
||||
});
|
||||
|
||||
// Run the I/O service. The call will return when
|
||||
// the socket is closed.
|
||||
|
||||
Reference in New Issue
Block a user