XinStellaris commented on code in PR #1312:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/1312#discussion_r964867813


##########
netutils/dhcpc/dhcpc.c:
##########
@@ -804,67 +811,70 @@ int dhcpc_request(FAR void *handle, FAR struct 
dhcpc_state *presult)
 
       /* Get the ACK/NAK response to the REQUEST (or timeout) */
 
-      result = recv(pdhcpc->sockfd, &pdhcpc->packet,
-                    sizeof(struct dhcp_msg), 0);
-      if (result >= 0)
+      recv_begin = clock();
+      do
         {
-          /* Parse the response */
+          result = recv(pdhcpc->sockfd, &pdhcpc->packet,
+                        sizeof(struct dhcp_msg), 0);
+          if (result >= 0)
+            {
+              /* Parse the response */
 
-          msgtype = dhcpc_parsemsg(pdhcpc, result, presult);
+              msgtype = dhcpc_parsemsg(pdhcpc, result, presult);
 
-          /* The ACK response means that the server has accepted
-           * our request and we have the lease.
-           */
+              /* The ACK response means that the server has accepted
+               * our request and we have the lease.
+               */
 
-          if (msgtype == DHCPACK)
-            {
-              ninfo("Received ACK\n");
-              state = STATE_HAVE_LEASE;
-            }
+              if (msgtype == DHCPACK)
+                {
+                  ninfo("Received ACK\n");
+                  state = STATE_HAVE_LEASE;
+                }
 
-          /* NAK means the server has refused our request.  Break out of
-           * this loop with state == STATE_HAVE_OFFER and send DISCOVER
-           * again
-           */
+              /* NAK means the server has refused our request */
 
-          else if (msgtype == DHCPNAK)
-            {
-              ninfo("Received NAK\n");
-              break;
-            }
+              else if (msgtype == DHCPNAK)
+                {
+                  ninfo("Received NAK\n");
+                  return ERROR;

Review Comment:
   The "goes back to send DISCOVER" was invalid since 
https://github.com/apache/incubator-nuttx-apps/pull/862



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to