Skip to content

Commit

Permalink
Disable example on noBOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
FAlbertDev committed Aug 15, 2024
1 parent 188d522 commit de468cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/examples/tls_stream_coroutine_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@

#include <botan/asio_compat.h>

#if !defined(BOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT)

int main() {
std::cout << "Your system needs an auto seeded RNG and a certificate store.\n";
return 1;
}

// Boost 1.81.0 introduced support for the finalized C++20 coroutines
// in clang 14 and newer. Older versions of Boost might work with other
// compilers, though.
#if defined(BOTAN_FOUND_COMPATIBLE_BOOST_ASIO_VERSION) && BOOST_VERSION >= 108100
#elif defined(BOTAN_FOUND_COMPATIBLE_BOOST_ASIO_VERSION) && BOOST_VERSION >= 108100

#include <botan/asio_stream.h>
#include <botan/version.h>
Expand Down Expand Up @@ -43,6 +50,7 @@ net::awaitable<void> request(std::string host, std::string port, std::string tar
const auto dns_result = co_await resolver.async_resolve(host, port);

// Connect to host and establish a TLS session
// TODO: This constructor needs BOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT. Is there any other way?
auto tls_stream =
tls::Stream(tls::Server_Information(host),
net::use_awaitable.as_default_on(beast::tcp_stream(co_await net::this_coro::executor)));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tls/asio/asio_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Stream {
std::shared_ptr<StreamCallbacks> callbacks = std::make_shared<StreamCallbacks>()) :
Stream(std::move(context), std::move(callbacks), std::forward<Arg>(arg)) {}

#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
#if defined(BOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT)
/**
* @brief Conveniently construct a new Stream with default settings
*
Expand Down

0 comments on commit de468cd

Please sign in to comment.