Skip to content

Commit 809dabf

Browse files
committed
correctly destroy cryptinfo
1 parent 9b8a01f commit 809dabf

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

includes/FastEngine/network/C_client.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ class FGE_API Client
219219
};
220220

221221
Client();
222+
~Client();
222223
/**
223224
* \brief Constructor with default latencies
224225
*

sources/network/C_client.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "FastEngine/network/C_client.hpp"
1818
#include "FastEngine/C_random.hpp"
1919
#include "FastEngine/network/C_server.hpp"
20+
#include "private/fge_crypt.hpp"
2021
#include <limits>
2122

2223
namespace fge::net
@@ -93,6 +94,10 @@ Client::Client() :
9394
g_currentPacketCounter(0),
9495
g_clientPacketCounter(0)
9596
{}
97+
Client::~Client()
98+
{
99+
priv::CryptClientDestroy(*this);
100+
}
96101
Client::Client(Latency_ms CTOSLatency, Latency_ms STOCLatency) :
97102
g_correctorTimestamp(std::nullopt),
98103
g_CTOSLatency_ms(CTOSLatency),

sources/private/fge_crypt.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ void CryptUninit(void*& ctx)
229229

230230
bool CryptClientCreate(void* ctx, net::Client& client)
231231
{
232+
CryptClientDestroy(client);
233+
232234
// Create an SSL object and memory BIOs
233235
SSL* ssl = SSL_new(static_cast<SSL_CTX*>(ctx));
234236
if (ssl == nullptr)
@@ -266,6 +268,8 @@ bool CryptClientCreate(void* ctx, net::Client& client)
266268
}
267269
bool CryptServerCreate(void* ctx, net::Client& client)
268270
{
271+
CryptClientDestroy(client);
272+
269273
// Create an SSL object and memory BIOs
270274
SSL* ssl = SSL_new(static_cast<SSL_CTX*>(ctx));
271275
if (ssl == nullptr)

0 commit comments

Comments
 (0)