csp_if_udp: rx_loop: Restructure the nested while-loop
Split the nested while-loop into two concecutive while-loop.  The
first one loops until we get a valid sockfd.  And then move onto the
loop to call csp_if_udp_rx_work().  We never exit from the last loop.
@@ -80,17 +80,15 @@ CSP_DEFINE_TASK(csp_if_udp_rx_loop) {
csp_iface_t * iface = param;
csp_if_udp_conf_t * ifconf = iface->driver_data;
-
- while (1) {
-
int sockfd;
+ do {
sockfd = csp_if_udp_rx_get_socket(ifconf->lport);
if (sockfd < 0) {
printf("UDP server waiting for port %d\n", ifconf->lport);
sleep(1);
- continue;
}
+ } while (sockfd < 0);
while (1) {
int ret;
@@ -102,7 +100,6 @@ CSP_DEFINE_TASK(csp_if_udp_rx_loop) {
csp_sleep_ms(10);
}
}
- }
return CSP_TASK_RETURN;
}
