From fd3d2ff645c76bc217507d63b979f70e96c23013 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Sat, 17 Feb 2018 15:59:49 +0100 Subject: [PATCH] Move app initialization code in simhost.c to one place --- examples/tftp/tftp_example.c | 2 ++ ports/unix/unixsim/simhost.c | 38 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/examples/tftp/tftp_example.c b/examples/tftp/tftp_example.c index d45ddf7..faf71f5 100644 --- a/examples/tftp/tftp_example.c +++ b/examples/tftp/tftp_example.c @@ -27,6 +27,8 @@ * */ +#include + #include "lwip/apps/tftp_server.h" #include "tftp_example.h" diff --git a/ports/unix/unixsim/simhost.c b/ports/unix/unixsim/simhost.c index 629241c..e527f7c 100644 --- a/ports/unix/unixsim/simhost.c +++ b/ports/unix/unixsim/simhost.c @@ -215,6 +215,25 @@ tcpip_init_done(void *arg) init_netifs(); +#if LWIP_TCP + netio_init(); +#endif +#if LWIP_TCP && LWIP_NETCONN + tcpecho_init(); + shell_init(); + httpd_init(); +#endif +#if LWIP_UDP && LWIP_NETCONN + udpecho_init(); +#endif +#if LWIP_SOCKET + chargen_init(); +#endif + +#if LWIP_MQTT + mqtt_example_init(); +#endif + #if LWIP_IPV4 netbiosns_set_name("simhost"); netbiosns_init(); @@ -499,25 +518,6 @@ init_netifs(void) /* Only used for testing purposes: */ netif_add(&ipaddr, &netmask, &gw, NULL, pcapif_init, tcpip_input); #endif - -#if LWIP_TCP - netio_init(); -#endif -#if LWIP_TCP && LWIP_NETCONN - tcpecho_init(); - shell_init(); - httpd_init(); -#endif -#if LWIP_UDP && LWIP_NETCONN - udpecho_init(); -#endif -#if LWIP_SOCKET - chargen_init(); -#endif - -#if LWIP_MQTT - mqtt_example_init(); -#endif /* sys_timeout(5000, tcp_debug_timeout, NULL);*/ }