diff --git a/source/ftpServer.cpp b/source/ftpServer.cpp index 601f3e4..da0511f 100644 --- a/source/ftpServer.cpp +++ b/source/ftpServer.cpp @@ -165,12 +165,6 @@ std::time_t FtpServer::startTime () void FtpServer::handleNetworkFound () { - { - auto lock = std::scoped_lock (m_lock); - if (m_socket) - return; - } - struct sockaddr_in addr; addr.sin_family = AF_INET; #if defined(_3DS) || defined(__SWITCH__) @@ -216,8 +210,11 @@ void FtpServer::handleNetworkLost () void FtpServer::loop () { - if (platform::networkVisible ()) - handleNetworkFound (); + if (!m_socket) + { + if (platform::networkVisible ()) + handleNetworkFound (); + } // poll listen socket if (m_socket) diff --git a/source/switch/init.c b/source/switch/init.c index 3df6113..31e985f 100644 --- a/source/switch/init.c +++ b/source/switch/init.c @@ -56,6 +56,7 @@ void userAppInit () romfsInit (); plInitialize (); + nifmInitialize (NifmServiceType_User); if (R_FAILED (socketInitialize (&s_socketInitConfig))) return; @@ -76,6 +77,7 @@ void userAppExit () } #endif + nifmExit (); plExit (); romfsExit (); appletUnlockExit ();