Define NMRP_ETH_TIMEOUT_S constant and use it in Ethernet connection timeout logic

This commit is contained in:
Eric Shu 2024-11-23 19:17:58 -08:00
parent 4a10c53b1a
commit 25945b162d
2 changed files with 3 additions and 1 deletions

2
nmrp.c
View file

@ -497,7 +497,7 @@ int nmrp_do(struct nmrpd_args *args)
bool unplugged = true;
time_t beg = time_monotonic();
while (!g_interrupted && (time_monotonic() - beg) < 60) {
while (!g_interrupted && (time_monotonic() - beg) < NMRP_ETH_TIMEOUT_S) {
if (!ethsock_is_unplugged(sock)) {
unplugged = false;
break;

View file

@ -84,6 +84,8 @@
#define NMRP_DEFAULT_SUBNET "255.255.255.0"
#define NMRP_DEFAULT_TFTP_PORT 69
#define NMRP_ETH_TIMEOUT_S 60
struct eth_hdr {
uint8_t ether_dhost[6];
uint8_t ether_shost[6];