Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated code to shutdown on tunnel close callback #426

Merged
merged 7 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/docker-images/integration-tests/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN apt update && apt upgrade -y && \
RUN mkdir /home/dependencies
WORKDIR /home/dependencies

RUN wget https://www.zlib.net/zlib-1.2.13.tar.gz -O /tmp/zlib-1.2.13.tar.gz && \
tar xzvf /tmp/zlib-1.2.13.tar.gz && \
cd zlib-1.2.13 && \
RUN wget https://www.zlib.net/zlib-1.3.tar.gz -O /tmp/zlib-1.3.tar.gz && \
tar xzvf /tmp/zlib-1.3.tar.gz && \
cd zlib-1.3 && \
./configure && \
make && \
make install && \
Expand Down
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 instance if secure tunnel is closed for a 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
Loading