Moved lwIP initialization from tap to zts_start for faster startup

This commit is contained in:
Joseph Henry
2019-02-06 23:34:26 -08:00
parent ef8689b0b8
commit 4de1068b57
2 changed files with 2 additions and 1 deletions

View File

@@ -42,6 +42,7 @@
#include "concurrentqueue.h" #include "concurrentqueue.h"
#include "libzt.h" #include "libzt.h"
#include "lwipDriver.hpp"
#if defined(_WIN32) #if defined(_WIN32)
WSADATA wsaData; WSADATA wsaData;
@@ -413,6 +414,7 @@ zts_err_t zts_deorbit(uint64_t moonWorldId)
zts_err_t zts_start(const char *path, void (*callback)(uint64_t, int), int port) zts_err_t zts_start(const char *path, void (*callback)(uint64_t, int), int port)
{ {
Mutex::Lock _l(_service_lock); Mutex::Lock _l(_service_lock);
lwip_driver_init();
if (service || _run_service) { if (service || _run_service) {
// Service is already initialized // Service is already initialized
return ZTS_ERR_INVALID_OP; return ZTS_ERR_INVALID_OP;

View File

@@ -82,7 +82,6 @@ VirtualTap::VirtualTap(
snprintf(vtap_full_name, sizeof(vtap_full_name), "libzt%llx", (unsigned long long)_nwid); snprintf(vtap_full_name, sizeof(vtap_full_name), "libzt%llx", (unsigned long long)_nwid);
_dev = vtap_full_name; _dev = vtap_full_name;
::pipe(_shutdownSignalPipe); ::pipe(_shutdownSignalPipe);
lwip_driver_init();
// Start virtual tap thread and stack I/O loops // Start virtual tap thread and stack I/O loops
_thread = Thread::start(this); _thread = Thread::start(this);
} }