Skip to content

Commit

Permalink
Merge pull request #83 from SiMet/patch-2
Browse files Browse the repository at this point in the history
Close binded sockets when watchNetLink is finished
  • Loading branch information
MarcinMiklas authored Feb 28, 2023
2 parents 4e4719e + 62383de commit 27b0abb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion linux/src/linux_hal_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 ...");
}

Expand Down

0 comments on commit 27b0abb

Please sign in to comment.