Commit ff772ebf authored by Alessandro Rubini's avatar Alessandro Rubini

bootp: trivial: use the new task_not_yet() helper

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d529ae44
...@@ -100,9 +100,6 @@ static int bootp_poll(void) ...@@ -100,9 +100,6 @@ static int bootp_poll(void)
uint8_t buf[400]; uint8_t buf[400];
int len, ret = 0; int len, ret = 0;
if (!bootp_tics) /* first time ever */
bootp_tics = timer_get_tics() - 1;
len = ptpd_netif_recvfrom(bootp_socket, &addr, len = ptpd_netif_recvfrom(bootp_socket, &addr,
buf, sizeof(buf), NULL); buf, sizeof(buf), NULL);
...@@ -112,12 +109,11 @@ static int bootp_poll(void) ...@@ -112,12 +109,11 @@ static int bootp_poll(void)
if (len > 0) if (len > 0)
ret = process_bootp(buf, len); ret = process_bootp(buf, len);
if (time_before(timer_get_tics(), bootp_tics)) if (task_not_yet(&bootp_tics, TICS_PER_SECOND))
return ret; return 0;
len = prepare_bootp(&addr, buf, ++bootp_retry); len = prepare_bootp(&addr, buf, ++bootp_retry);
ptpd_netif_sendto(bootp_socket, &addr, buf, len, 0); ptpd_netif_sendto(bootp_socket, &addr, buf, len, 0);
bootp_tics = timer_get_tics() + TICS_PER_SECOND;
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment