Fixed the Logging system to actually be able to handle errors. Database is also fixed to use directories.
This commit is contained in:
@@ -130,7 +130,7 @@ namespace ehs
|
||||
int err = SSL_accept(client->sslHdl);
|
||||
if (!err)
|
||||
{
|
||||
EHS_LOG_INT("Error", 0, "Failed SSL handshake with error #" + Str_8::FromNum(SSL_get_error(client->sslHdl, err)) + ".");
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed SSL handshake with error #" + Str_8::FromNum(SSL_get_error(client->sslHdl, err)) + ".");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace ehs
|
||||
{
|
||||
int code = SSL_get_error(sslHdl, written);
|
||||
ERR_print_errors_fp(stderr);
|
||||
EHS_LOG_INT("Error", 0, "Failed to send data with error #" + Str_8::FromNum(code) + ".");
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to send data with error #" + Str_8::FromNum(code) + ".");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace ehs
|
||||
{
|
||||
int code = SSL_get_error(sslHdl, received);
|
||||
ERR_print_errors_fp(stderr);
|
||||
EHS_LOG_INT("Error", 0, "Failed to receive data with error #" + Str_8::FromNum(code) + ".");
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to receive data with error #" + Str_8::FromNum(code) + ".");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -184,13 +184,13 @@ namespace ehs
|
||||
X509 *cert = d2i_X509(nullptr, &data, (long)size);
|
||||
if (!cert)
|
||||
{
|
||||
EHS_LOG_INT("Error", 0, "Invalid certificate.");
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Invalid certificate.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (SSL_CTX_use_certificate(ctx, cert) != 1)
|
||||
{
|
||||
EHS_LOG_INT("Error", 1, "Failed to use certificate.");
|
||||
EHS_LOG_INT(LogType::ERR, 1, "Failed to use certificate.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,13 +202,13 @@ namespace ehs
|
||||
EVP_PKEY *key = d2i_PrivateKey(EVP_PKEY_RSA, nullptr, &data, (long)size);
|
||||
if (!key)
|
||||
{
|
||||
EHS_LOG_INT("Error", 0, "Invalid private key.");
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Invalid private key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (SSL_CTX_use_PrivateKey(ctx, key) != 1)
|
||||
{
|
||||
EHS_LOG_INT("Error", 1, "Failed to use private key.");
|
||||
EHS_LOG_INT(LogType::ERR, 1, "Failed to use private key.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user