You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/08/11 18:33:58 UTC

[incubator-nuttx-apps] 01/02: netutils/ftpc: Embed wdog_s in ftpc_session_s directly

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit bf4c36c83f180b348bd9a4b171ad8e5e46d5d1e6
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Aug 10 02:31:34 2020 +0800

    netutils/ftpc: Embed wdog_s in ftpc_session_s directly
    
    follow up the kernel side change
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 netutils/ftpc/ftpc_connect.c  | 10 +++-------
 netutils/ftpc/ftpc_getreply.c |  9 +++++----
 netutils/ftpc/ftpc_internal.h |  2 +-
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/netutils/ftpc/ftpc_connect.c b/netutils/ftpc/ftpc_connect.c
index c7c2017..f2ce0f8 100644
--- a/netutils/ftpc/ftpc_connect.c
+++ b/netutils/ftpc/ftpc_connect.c
@@ -103,10 +103,6 @@ SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
 
   session->homeldir = strdup(ftpc_lpwd());
 
-  /* Create up a timer to prevent hangs */
-
-  session->wdog = wd_create();
-
   /* And (Re-)connect to the server */
 
   ret = ftpc_reconnect(session);
@@ -152,8 +148,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
 
   /* Set up a timer to prevent hangs */
 
-  ret = wd_start(session->wdog,
-                 session->conntimeo, ftpc_timeout, 1, session);
+  ret = wd_start(&session->wdog, session->conntimeo,
+                 ftpc_timeout, 1, (wdparm_t)session);
   if (ret != OK)
     {
       nerr("ERROR: wd_start() failed\n");
@@ -214,7 +210,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
       fptc_getreply(session);
     }
 
-  wd_cancel(session->wdog);
+  wd_cancel(&session->wdog);
 
   if (!ftpc_sockconnected(&session->cmd))
     {
diff --git a/netutils/ftpc/ftpc_getreply.c b/netutils/ftpc/ftpc_getreply.c
index b09ff22..e54b84a 100644
--- a/netutils/ftpc/ftpc_getreply.c
+++ b/netutils/ftpc/ftpc_getreply.c
@@ -215,7 +215,8 @@ int fptc_getreply(struct ftpc_session_s *session)
 
   if (session->replytimeo)
     {
-      ret = wd_start(session->wdog, session->replytimeo, ftpc_timeout, 1, session);
+      ret = wd_start(&session->wdog, session->replytimeo,
+                     ftpc_timeout, 1, (wdparm_t)session);
     }
 
   /* Get the next line from the server */
@@ -228,7 +229,7 @@ int fptc_getreply(struct ftpc_session_s *session)
     {
       /* No.. cancel the timer and return an error */
 
-      wd_cancel(session->wdog);
+      wd_cancel(&session->wdog);
       ninfo("Lost connection\n");
       return ERROR;
     }
@@ -239,7 +240,7 @@ int fptc_getreply(struct ftpc_session_s *session)
     {
       /* No.. cancel the timer and return an error */
 
-      wd_cancel(session->wdog);
+      wd_cancel(&session->wdog);
       ninfo("ftpc_gets failed\n");
       return ERROR;
     }
@@ -263,6 +264,6 @@ int fptc_getreply(struct ftpc_session_s *session)
       while (strncmp(tmp, session->reply, 4) != 0);
     }
 
-  wd_cancel(session->wdog);
+  wd_cancel(&session->wdog);
   return ret;
 }
diff --git a/netutils/ftpc/ftpc_internal.h b/netutils/ftpc/ftpc_internal.h
index 0dfe733..68e90cc 100644
--- a/netutils/ftpc/ftpc_internal.h
+++ b/netutils/ftpc/ftpc_internal.h
@@ -165,7 +165,7 @@ struct ftpc_session_s
   struct ftpc_socket_s cmd;        /* FTP command channel */
   struct ftpc_socket_s data;       /* FTP data channel */
   struct ftpc_socket_s dacceptor;  /* FTP data listener (accepts data connection in active mode) */
-  WDOG_ID              wdog;       /* Timer */
+  struct wdog_s        wdog;       /* Timer */
   FAR char            *uname;      /* Login uname */
   FAR char            *pwd;        /* Login pwd  */
   FAR char            *initrdir;   /* Initial remote directory */