From 71c41df6cd794b670f9a16ca060a9c4ab054200e Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 1 Jun 2017 15:59:57 +0200 Subject: [PATCH] Close socket by default when destroying object As socket is back to only movable, only one copy of a socket can be present at a time, so when the object is destroyed we have to close the socket too. Change-Id: Id64bb53919ce7c24476c26ba9a8520affa3f6273 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp index 3aa34d22..71588a6e 100644 --- a/CAN-binder/low-can-binding/utils/socketcan.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan.cpp @@ -45,7 +45,10 @@ namespace utils } socketcan_t::~socketcan_t() - {} + { + close(); + socket_ = INVALID_SOCKET; + } const struct sockaddr_can& socketcan_t::get_tx_address() const { -- 2.16.6