Backup.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ehs/io/socket/SSL.h"
|
||||
#include "ehs/io/Console.h"
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/bio.h>
|
||||
@@ -163,10 +164,16 @@ namespace ehs
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
SSL_load_error_strings();
|
||||
|
||||
if (!OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, nullptr))
|
||||
{
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to initialize OpenSSL.");
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = SSL_CTX_new(TLS_client_method());
|
||||
if (!ctx)
|
||||
{
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to creat SSL context.");
|
||||
EHS_LOG_INT(LogType::ERR, 1, "Failed to creat SSL context.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,7 +189,19 @@ namespace ehs
|
||||
SInt_32 rc = SSL_connect(sslHdl);
|
||||
if (rc != 1)
|
||||
{
|
||||
EHS_LOG_INT(LogType::ERR, 1, "Failed to connect with error #" + Str_8::FromNum(SSL_get_error(sslHdl, rc)) + ".");
|
||||
SInt_32 err = SSL_get_error(sslHdl, rc);
|
||||
if (err == SSL_ERROR_SSL)
|
||||
{
|
||||
UInt_32 e;
|
||||
while ((e = ERR_get_error()) != 0)
|
||||
{
|
||||
char buf[256];
|
||||
ERR_error_string_n(e, buf, sizeof(buf));
|
||||
Console::Write_8(Str_8(buf));
|
||||
}
|
||||
}
|
||||
|
||||
EHS_LOG_INT(LogType::ERR, 2, "Failed to connect with error #" + Str_8::FromNum(err) + ".");
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -406,6 +406,10 @@ namespace ehs
|
||||
return result;
|
||||
}
|
||||
|
||||
void TCP::SetReuse(const bool &value)
|
||||
{
|
||||
}
|
||||
|
||||
bool TCP::IsValid() const
|
||||
{
|
||||
return hdl != EHS_INVALID_SOCKET;
|
||||
|
Reference in New Issue
Block a user