More SSL stuff (still doesn't work :/).
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#if !defined(MIJIN_NET_SSL_HPP_INCLUDED)
|
||||
#define MIJIN_NET_SSL_HPP_INCLUDED 1
|
||||
|
||||
#if !MIJIN_ENABLE_OPENSSL
|
||||
#error "SSL support not enabled. Set MIJIN_ENABLE_OPENSSL to True in your environment settings."
|
||||
#if !defined(MIJIN_ENABLE_OPENSSL)
|
||||
#error "SSL support not enabled. Set MIJIN_ENABLE_OPENSSL to True in your SCons environment settings."
|
||||
#endif // !MIJIN_ENABLE_OPENSSL
|
||||
|
||||
#include <memory>
|
||||
@@ -45,13 +45,15 @@ private:
|
||||
|
||||
|
||||
template<typename TFunc, typename... TArgs>
|
||||
auto runIOLoop(TFunc&& func, TArgs&&... args) -> std::decay_t<std::invoke_result_t<TFunc, ossl::Ssl&, TArgs...>>
|
||||
auto runIOLoop(TFunc&& func, bool block, TArgs&&... args) -> std::decay_t<std::invoke_result_t<TFunc, ossl::Ssl&, TArgs...>>
|
||||
{
|
||||
using result_t = std::decay_t<std::invoke_result_t<TFunc, ossl::Ssl&, TArgs...>>;
|
||||
while (true)
|
||||
const std::size_t maxTries = block ? std::numeric_limits<std::size_t>::max() : 10;
|
||||
|
||||
ossl::Error error;
|
||||
for (std::size_t tryNum = 0; tryNum < maxTries; ++tryNum)
|
||||
{
|
||||
auto result = std::invoke(std::forward<TFunc>(func), ssl_, std::forward<TArgs>(args)...);
|
||||
ossl::Error error;
|
||||
if constexpr (std::is_same_v<result_t, ossl::Error>)
|
||||
{
|
||||
if (error.isSuccess())
|
||||
@@ -86,6 +88,7 @@ private:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
// mijin::Task<StreamError> c_readRaw(std::span<std::uint8_t> buffer, const ReadOptions& options = {}, std::size_t* outBytesRead = nullptr) override;
|
||||
// mijin::Task<StreamError> c_writeRaw(std::span<const std::uint8_t> buffer) override;
|
||||
|
||||
Reference in New Issue
Block a user