samples: net: http: Remove net_app_init() calls
As the net app API is automatically initialized, there is no need to call net_app_init() by the http client and server sample applications. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
d14d167188
commit
5f9d79f290
4 changed files with 3 additions and 28 deletions
|
@ -307,11 +307,6 @@ void main(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = net_app_init("Run HTTP client", 0, APP_STARTUP_TIME);
|
|
||||||
if (ret < 0) {
|
|
||||||
panic("Application init failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = http_client_init(&http_ctx, SERVER_ADDR, SERVER_PORT);
|
ret = http_client_init(&http_ctx, SERVER_ADDR, SERVER_PORT);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
NET_ERR("HTTP init failed (%d)", ret);
|
NET_ERR("HTTP init failed (%d)", ret);
|
||||||
|
|
|
@ -37,6 +37,9 @@ CONFIG_NET_APP_SETTINGS=y
|
||||||
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"
|
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"
|
||||||
CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1"
|
CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1"
|
||||||
|
|
||||||
|
CONFIG_NET_APP_NEED_IPV6=y
|
||||||
|
CONFIG_NET_APP_NEED_IPV4=y
|
||||||
|
|
||||||
CONFIG_NET_SHELL=y
|
CONFIG_NET_SHELL=y
|
||||||
CONFIG_NET_STATISTICS=y
|
CONFIG_NET_STATISTICS=y
|
||||||
|
|
||||||
|
|
|
@ -270,26 +270,8 @@ static int setup_cert(struct http_server_ctx *ctx,
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
struct sockaddr addr, *server_addr;
|
struct sockaddr addr, *server_addr;
|
||||||
u32_t flags = 0;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
|
||||||
* If we have both IPv6 and IPv4 enabled, then set the
|
|
||||||
* startup flags so that we wait until both are ready
|
|
||||||
* before continuing.
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_NET_IPV6)
|
|
||||||
flags |= NET_APP_NEED_IPV6;
|
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_NET_IPV4)
|
|
||||||
flags |= NET_APP_NEED_IPV4;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = net_app_init(APP_BANNER, flags, APP_STARTUP_TIME);
|
|
||||||
if (ret < 0) {
|
|
||||||
panic("Application init failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are several options here for binding to local address.
|
* There are several options here for binding to local address.
|
||||||
* 1) The server address can be left empty in which case the
|
* 1) The server address can be left empty in which case the
|
||||||
|
|
|
@ -370,11 +370,6 @@ void main(void)
|
||||||
bool failure = false;
|
bool failure = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = net_app_init("Run HTTPS client", 0, APP_STARTUP_TIME);
|
|
||||||
if (ret < 0) {
|
|
||||||
panic("Application init failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = https_client_init(&https_ctx, SERVER_ADDR, SERVER_PORT,
|
ret = https_client_init(&https_ctx, SERVER_ADDR, SERVER_PORT,
|
||||||
(u8_t *)INSTANCE_INFO, strlen(INSTANCE_INFO),
|
(u8_t *)INSTANCE_INFO, strlen(INSTANCE_INFO),
|
||||||
setup_cert, HOSTNAME, NULL, &ssl_rx_pool,
|
setup_cert, HOSTNAME, NULL, &ssl_rx_pool,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue