mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-21 06:11:35 +08:00
NTP Client: All retries; Add initialization in NSH network startup logic.
This commit is contained in:

committed by
Gregory Nutt

parent
7a5ceb244e
commit
bfd5ca7cd2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_netinit.c
|
||||
*
|
||||
* Copyright (C) 2010-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010-2012, 2014-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* This is influenced by similar logic from uIP:
|
||||
@@ -72,6 +72,10 @@
|
||||
# include <apps/netutils/dhcpc.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETUTILS_NTPCLIENT
|
||||
# include <apps/netutils/ntpclient.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
@@ -128,7 +132,6 @@
|
||||
# undef CONFIG_NSH_NETINIT_MONITOR
|
||||
#endif
|
||||
|
||||
|
||||
/* We need a valid IP domain (any domain) to create a socket that we can use
|
||||
* to comunicate with the network device.
|
||||
*/
|
||||
@@ -147,10 +150,6 @@
|
||||
#define LONG_TIME_SEC (60*60) /* One hour in seconds */
|
||||
#define SHORT_TIME_SEC (2) /* 2 seconds */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -203,10 +202,6 @@ static const uint16_t g_ipv6_netmask[8] =
|
||||
};
|
||||
#endif /* CONFIG_NET_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF*/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -342,6 +337,12 @@ static void nsh_netinit_configure(void)
|
||||
dhcpc_close(handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETUTILS_NTPCLIENT
|
||||
/* Start the NTP client */
|
||||
|
||||
ntpc_start();
|
||||
#endif
|
||||
#endif /* NSH_HAVE_NETDEV */
|
||||
|
||||
nvdbg("Exit\n");
|
||||
|
Reference in New Issue
Block a user