[api] Optimize APINoiseContext memory usage by removing shared_ptr overhead (#11981)

This commit is contained in:
J. Nick Koston
2025-11-25 06:52:15 +13:00
committed by GitHub
parent 09f3f62194
commit c888becfa7
7 changed files with 15 additions and 16 deletions
+2 -2
View File
@@ -90,8 +90,8 @@ static const int CAMERA_STOP_STREAM = 5000;
APIConnection::APIConnection(std::unique_ptr<socket::Socket> sock, APIServer *parent)
: parent_(parent), initial_state_iterator_(this), list_entities_iterator_(this) {
#if defined(USE_API_PLAINTEXT) && defined(USE_API_NOISE)
auto noise_ctx = parent->get_noise_ctx();
if (noise_ctx->has_psk()) {
auto &noise_ctx = parent->get_noise_ctx();
if (noise_ctx.has_psk()) {
this->helper_ =
std::unique_ptr<APIFrameHelper>{new APINoiseFrameHelper(std::move(sock), noise_ctx, &this->client_info_)};
} else {