Skip to content

Commit

Permalink
updated code to shutdown on tunnel close callback
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshGandhi-AWS committed Sep 28, 2023
1 parent 95db8c9 commit 726d4d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ namespace Aws
case ClientBaseEventNotification::FEATURE_STOPPED:
{
LOGM_INFO(TAG, "%s has stopped", feature->getName().c_str());
// Stopping DC for ST component
#if defined(DISABLE_MQTT)
shutdown();
#endif
break;
}
default:
Expand Down
5 changes: 4 additions & 1 deletion source/tunneling/SecureTunnelingFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,15 @@ namespace Aws
void SecureTunnelingFeature::OnConnectionShutdown(SecureTunnelingContext *contextToRemove)
{
LOG_DEBUG(TAG, "SecureTunnelingFeature::OnConnectionShutdown");

#if defined(DISABLE_MQTT)
this->stop();
#else
auto it =
find_if(mContexts.begin(), mContexts.end(), [&](const unique_ptr<SecureTunnelingContext> &c) {
return c.get() == contextToRemove;
});
mContexts.erase(std::remove(mContexts.begin(), mContexts.end(), *it));
#endif
}

} // namespace SecureTunneling
Expand Down

0 comments on commit 726d4d4

Please sign in to comment.