summaryrefslogtreecommitdiffstats
path: root/apps/http-proxy/src/forwarder_interface.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apps/http-proxy/src/forwarder_interface.cc')
-rw-r--r--apps/http-proxy/src/forwarder_interface.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/http-proxy/src/forwarder_interface.cc b/apps/http-proxy/src/forwarder_interface.cc
index 105d5a8e9..d80939b8b 100644
--- a/apps/http-proxy/src/forwarder_interface.cc
+++ b/apps/http-proxy/src/forwarder_interface.cc
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "forwarder_interface.h"
+#include <hicn/http-proxy/forwarder_interface.h>
#include <arpa/inet.h>
#include <hicn/transport/utils/log.h>
@@ -41,16 +41,18 @@ int ForwarderInterface::connectToForwarder() {
}
void ForwarderInterface::close() {
- internal_ioservice_.post([this]() {
- work_.reset();
- if (sock_) {
- hc_sock_free(sock_);
- sock_ = nullptr;
- }
- });
+ if (!closed_) {
+ internal_ioservice_.post([this]() {
+ work_.reset();
+ if (sock_) {
+ hc_sock_free(sock_);
+ sock_ = nullptr;
+ }
+ });
- if (thread_->joinable()) {
- thread_->join();
+ if (thread_->joinable()) {
+ thread_->join();
+ }
}
}