summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-01 15:59:57 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-01 18:40:13 +0200
commit71c41df6cd794b670f9a16ca060a9c4ab054200e (patch)
tree1842467c76cc68ab39f66c881653e7ab6ca9382c /CAN-binder/low-can-binding/utils
parente7864bd53878176fd7855d31e9141bd09efc33ad (diff)
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils')
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.cpp5
1 files changed, 4 insertions, 1 deletions
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
{