From 4e0039625e967eb5fa2c5907c4a104ba55a419a9 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 31 Mar 2022 18:07:15 +0100 Subject: [PATCH] Remove cruft --- examples/zephyr/http-server/src/main.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/examples/zephyr/http-server/src/main.c b/examples/zephyr/http-server/src/main.c index bf20b9bf..4f0d1f8d 100644 --- a/examples/zephyr/http-server/src/main.c +++ b/examples/zephyr/http-server/src/main.c @@ -8,8 +8,6 @@ static const char *s_root_dir = "."; static const char *s_listening_address = "http://0.0.0.0:8000"; static time_t s_boot_timestamp = 0; static struct mg_connection *s_sntp_conn = NULL; -static struct net_mgmt_event_callback mgmt4_cb; -static bool s_network_initialised = false; // Event handler for the listening connection. // Simply serve static files from `s_root_dir` @@ -63,33 +61,12 @@ static void logfn(const void *ptr, size_t len, void *userdata) { printk("%.*s", (int) len, (char *) ptr); } -static void netcb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, - struct net_if *iface) { - char hr_addr[NET_IPV4_ADDR_LEN]; - if (mgmt_event == NET_EVENT_IPV4_ADDR_ADD) { - for (int i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) { - struct net_if_addr *if_addr = &iface->config.ip.ipv4->unicast[i]; - if (if_addr->addr_type != NET_ADDR_DHCP || !if_addr->is_used) continue; - MG_INFO( - ("IPv4 address: %s", net_addr_ntop(AF_INET, &if_addr->address.in_addr, - hr_addr, NET_IPV4_ADDR_LEN))); - s_network_initialised = true; - break; - } - } -} - int main(int argc, char *argv[]) { struct mg_mgr mgr; mg_log_set(s_debug_level); mg_log_set_callback(logfn, NULL); - // Wait until network is initialised - net_mgmt_init_event_callback(&mgmt4_cb, netcb, NET_EVENT_IPV4_ADDR_ADD); - net_mgmt_add_event_callback(&mgmt4_cb); - while (!s_network_initialised) k_sleep(K_MSEC(100)); - mg_mgr_init(&mgr); mg_http_listen(&mgr, s_listening_address, cb, &mgr);