Open
Description
Describe the bug
In SecureTunnelContext, we made a temporary fix for a segfault because we are trying to dereference a function pointer to onConnectionShutdown
that no longer exists during the shutdown process. This change means that there is a resource leak as the SecureTunnelingContext will still reside in memory for the duration that the application is alive. While this is the lesser of two evils, a refactor is needed to bring Secure Tunneling fully in alignment with the rest of our features.
if (mProxyOptions.HostName.length() > 0) {
LOGM_INFO(TAG, "Creating Secure Tunneling with proxy to: %s", mProxyOptions.HostName.c_str());
return std::make_shared<SecureTunnelWrapper>(
mSharedCrtResourceManager->getAllocator(),
mSharedCrtResourceManager->getClientBootstrap(),
Crt::Io::SocketOptions(),
mProxyOptions,
mAccessToken,
AWS_SECURE_TUNNELING_DESTINATION_MODE,
mEndpoint,
mRootCa,
onConnectionComplete,
nullptr, // TODO: long term fix needed for onConnectionShutdown callback
onSendDataComplete,
onDataReceive,
onStreamStart,
onStreamReset,
onSessionReset);
}