Squashed 'external/toxcore/c-toxcore/' changes from 59d3f6674..76bc4c496

76bc4c496 refactor: TCP connection netprof objects are now owned by Messenger

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: 76bc4c496d407cbbd11f0a0d9d3eebfbf64ccd2c
This commit is contained in:
Green Sky
2025-03-19 11:19:59 +01:00
parent 72325822b8
commit 119bd4fb1d
15 changed files with 96 additions and 65 deletions

View File

@ -10,6 +10,7 @@
#include "../testing/fuzzing/fuzz_tox.hh"
#include "DHT.h"
#include "TCP_client.h"
#include "net_profile.h"
#include "network.h"
namespace {
@ -65,12 +66,20 @@ void TestNetCrypto(Fuzz_Data &input)
return;
}
Net_Profile *tcp_np = netprof_new(logger.get(), sys.mem.get());
if (tcp_np == nullptr) {
return;
}
const TCP_Proxy_Info proxy_info = {0};
const Ptr<Net_Crypto> net_crypto(new_net_crypto(logger.get(), sys.mem.get(), sys.rng.get(),
sys.ns.get(), mono_time.get(), dht.get(), &proxy_info),
const Ptr<Net_Crypto> net_crypto(
new_net_crypto(logger.get(), sys.mem.get(), sys.rng.get(), sys.ns.get(), mono_time.get(),
dht.get(), &proxy_info, tcp_np),
kill_net_crypto);
if (net_crypto == nullptr) {
netprof_kill(sys.mem.get(), tcp_np);
return;
}
@ -81,6 +90,8 @@ void TestNetCrypto(Fuzz_Data &input)
// "Sleep"
sys.clock += System::BOOTSTRAP_ITERATION_INTERVAL;
}
netprof_kill(sys.mem.get(), tcp_np);
}
} // namespace