Skip to content
Snippets Groups Projects
Commit db44b8d9 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Sébastien Blin
Browse files

multiplexed socket: complete shutdown before destroy

When shutdown called from callback before it called from destructor sockets
could be destroyed.

Change-Id: I0fd92646726969c0d9b947a51fecbed495439fb8
parent e955e088
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,15 @@ public: ...@@ -51,7 +51,15 @@ public:
}) } { } }) } { }
~Impl() { ~Impl() {
shutdown(); if (!isShutdown_) {
shutdown();
} else {
std::lock_guard<std::mutex> lkSockets(socketsMutex);
for (auto& socket : sockets) {
if (socket.second) socket.second->stop();
}
sockets.clear();
}
} }
void shutdown() { void shutdown() {
...@@ -68,6 +76,7 @@ public: ...@@ -68,6 +76,7 @@ public:
// No need to write the EOF for the channel, the write will fail because endpoint is already shutdown // No need to write the EOF for the channel, the write will fail because endpoint is already shutdown
if (socket.second) socket.second->stop(); if (socket.second) socket.second->stop();
} }
sockets.clear();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment