Make sure the timeout actually gets processed. The right thing to do
for the receive loop is to check for timeout, then try to receive, and
loop until an acceptable packet has been received; we might as well do
that explicitly.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
continue;
oldtime = jiffies();
- while (1) {
+ do {
+ if (jiffies() - oldtime >= timeout)
+ goto again;
+
udp_read.status = 0;
udp_read.src_ip = srv;
udp_read.dest_ip = IPInfo.myip;
udp_read.buffer_size = PKTBUF_SIZE;
udp_read.buffer = FAR_PTR(DNSRecvBuf);
err = pxe_call(PXENV_UDP_READ, &udp_read);
- if (err || udp_read.status)
- continue;
-
- /* Got a packet, deal with it... */
- if (hd2->id == hd1->id)
- break;
+ } while (err || udp_read.status || hd2->id != hd1->id);
- if (jiffies() - oldtime >= timeout)
- goto again;
- }
if ((hd2->flags ^ 0x80) & htons(0xf80f))
goto badness;