From 789d41ff076cc31d2b1fd86b760006733d4cbf6a Mon Sep 17 00:00:00 2001
From: Seva <seva@binarytrails.net>
Date: Mon, 17 Jun 2019 16:42:12 -0400
Subject: [PATCH] dhtproxy: fix join on terminated thread

---
 src/dht_proxy_server.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 416a8f50..7a9194bd 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -142,7 +142,8 @@ DhtProxyServer::stop()
     logger_->d("[restinio] closing http server async operations");
     httpServer_->io_context().reset();
     httpServer_->io_context().stop();
-    httpServerThread_.join();
+    if (httpServerThread_.joinable())
+        httpServerThread_.join();
     logger_->d("[restinio] http server closed");
 }
 
-- 
GitLab