From: Romain Forlot Date: Thu, 1 Jun 2017 13:59:57 +0000 (+0200) Subject: Close socket by default when destroying object X-Git-Tag: Renesas_delivery_Q2~45 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=71c41df6cd794b670f9a16ca060a9c4ab054200e;p=apps%2Flow-level-can-service.git 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 --- diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp index 3aa34d2..71588a6 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 {