Using coroutines directly by the user e.g. declaring a function with
drogon::Task<> return type, will have it's continuation set to nullptr.
Returning nullptr causes a segfault and it must be checked before
returning e.g. the snippet form https://en.cppreference.com/w/cpp/coroutine/noop_coroutine
```cpp
struct final_awaiter
{
std::coroutine_handle<>
await_suspend(std::coroutine_handle<promise_type> h) noexcept
{
// final_awaiter::await_suspend is called when the execution of the
// current coroutine (referred to by 'h') is about to finish.
// If the current coroutine was resumed by another coroutine via
// co_await get_task(), a handle to that coroutine has been stored
// as h.promise().previous. In that case, return the handle to resume
// the previous coroutine.
// Otherwise, return noop_coroutine(), whose resumption does nothing.
if (auto previous = h.promise().previous; previous)
return previous;
else
return std::noop_coroutine();
}
};
```
This commit default initializes the continuation handle to no op coroutine and
avoids the check.
Signed-off-by: Omar Mohamed <mohamed.omar67492@gmail.com>
When compiling statically, cmake pulls shared libraries as dependencies
for drogon e.g. libpq.so instead of libpq.a. This causes linkage errors
when compiling the whole program.
The flag USE_STATIC_LIBS_ONLY should set the CMAKE_FIND_LIBRARY_SUFFIXES
to the appropriate suffix on different platforms, thus find_* commands
find the right library.
There is an error in the `app.log.use_spdlog` item in the default
config file in the yaml format.
While fixing this error, other minor problems in the config files were
fixed.
For example, some spelling errors and missing items in yaml format.
At the same time, different config files are modified to store the same
content.