netutils/ftpc: Embed wdog_s in ftpc_session_s directly

follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-08-10 02:31:34 +08:00 committed by patacongo
parent e6c5ff9208
commit bf4c36c83f
3 changed files with 9 additions and 12 deletions

View File

@ -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))
{

View File

@ -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;
}

View File

@ -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 */