Initialize nifm session for network check

This commit is contained in:
Michael Theall 2020-04-08 23:36:29 -05:00
parent 49b2571336
commit 7591a39cfd
2 changed files with 7 additions and 8 deletions

View File

@ -165,12 +165,6 @@ std::time_t FtpServer::startTime ()
void FtpServer::handleNetworkFound () void FtpServer::handleNetworkFound ()
{ {
{
auto lock = std::scoped_lock (m_lock);
if (m_socket)
return;
}
struct sockaddr_in addr; struct sockaddr_in addr;
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
#if defined(_3DS) || defined(__SWITCH__) #if defined(_3DS) || defined(__SWITCH__)
@ -216,8 +210,11 @@ void FtpServer::handleNetworkLost ()
void FtpServer::loop () void FtpServer::loop ()
{ {
if (!m_socket)
{
if (platform::networkVisible ()) if (platform::networkVisible ())
handleNetworkFound (); handleNetworkFound ();
}
// poll listen socket // poll listen socket
if (m_socket) if (m_socket)

View File

@ -56,6 +56,7 @@ void userAppInit ()
romfsInit (); romfsInit ();
plInitialize (); plInitialize ();
nifmInitialize (NifmServiceType_User);
if (R_FAILED (socketInitialize (&s_socketInitConfig))) if (R_FAILED (socketInitialize (&s_socketInitConfig)))
return; return;
@ -76,6 +77,7 @@ void userAppExit ()
} }
#endif #endif
nifmExit ();
plExit (); plExit ();
romfsExit (); romfsExit ();
appletUnlockExit (); appletUnlockExit ();