You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/05 02:24:33 UTC

[GitHub] [incubator-nuttx-apps] coffee809721232 commented on a change in pull request #904: netutils/dhcpc: add non-blocking interface

coffee809721232 commented on a change in pull request #904:
URL: https://github.com/apache/incubator-nuttx-apps/pull/904#discussion_r778506925



##########
File path: netutils/dhcpc/dhcpc.c
##########
@@ -445,6 +448,47 @@ static uint8_t dhcpc_parsemsg(FAR struct dhcpc_state_s *pdhcpc, int buflen,
   return 0;
 }
 
+/****************************************************************************
+ * Name: dhcpc_run
+ ****************************************************************************/
+
+static void *dhcpc_run(void *args)
+{
+  FAR struct dhcpc_state_s *pdhcpc = (FAR struct dhcpc_state_s *)args;
+  struct dhcpc_state result;
+  int ret;
+
+  while (1)
+    {
+      ret = dhcpc_request(pdhcpc, &result);
+      if (ret == OK)
+        {
+          pdhcpc->callback(&result);
+        }
+      else
+        {
+          pdhcpc->callback(NULL);
+          nerr("dhcpc_request error\n");
+        }
+
+      if (pdhcpc->cancel)
+        {
+          return NULL;
+        }
+
+      while (result.lease_time)
+        {
+          result.lease_time = sleep(result.lease_time);

Review comment:
       > Note: This should only sleep half of the lease_time before renewing.
   
   Yes, it should be half of the time to re-request.
   This bug will be fixed later.
   thanks. @normanr @xiaoxiang781216 




-- 
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-unsubscribe@nuttx.apache.org

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