From 62383de0a969c5db006350c7589e628cc9e3c46a Mon Sep 17 00:00:00 2001 From: Marek Szkowron Date: Mon, 17 May 2021 14:12:51 +0200 Subject: [PATCH] Close binded sockets when watchNetLink is finished close binded sockets when watchNetLink is finished --- linux/src/linux_hal_common.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/src/linux_hal_common.cpp b/linux/src/linux_hal_common.cpp index b651b88..0546462 100644 --- a/linux/src/linux_hal_common.cpp +++ b/linux/src/linux_hal_common.cpp @@ -337,7 +337,7 @@ void LinuxNetworkInterface::watchNetLink( CommonPort *iPort ) addr.nl_groups = RTMGRP_LINK; if (bind (netLinkSocket, (struct sockaddr *) &addr, sizeof (addr)) < 0) { - GPTP_LOG_ERROR("Socket bind failed"); + GPTP_LOG_ERROR("Socket (netLinkSocket) bind failed %s", strerror(errno)); close (netLinkSocket); return; } @@ -396,6 +396,8 @@ void LinuxNetworkInterface::watchNetLink( CommonPort *iPort ) GPTP_LOG_VERBOSE("Net link event timeout"); } } + close(inetSocket); + close(netLinkSocket); GPTP_LOG_DEBUG("Link watch thread terminated ..."); }