Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogServer: fix listening after suspending and resuming the system #166

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions kernel/src/Plugins/LogServer/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ bool LogManager::Startup()

WriteLog(LL_Error, "here");

// Make sure nothing's running
Teardown();

auto kthread_add = (int(*)(void(*func)(void*), void* arg, struct proc* procptr, struct thread** tdptr, int flags, int pages, const char* fmt, ...))kdlsym(kthread_add);
WriteLog(LL_Error, "m_Socket (%d) &m_Socket (%p) s_MainThread (%p)", m_Socket, &m_Socket, s_MainThread);

Expand Down Expand Up @@ -133,6 +136,9 @@ bool LogManager::Startup()
return false;
}

// Set our running state
m_Running = true;

// Create the new server processing thread, 8MiB stack
s_Ret = kthread_add(LogManager::ServerThread, this, Mira::Framework::GetFramework()->GetInitParams()->process, reinterpret_cast<thread**>(&m_Thread), 0, 200, "LogServer");
WriteLog(LL_Debug, "logserver kthread_add returned (%d).", s_Ret);
Expand Down Expand Up @@ -190,9 +196,6 @@ void LogManager::ServerThread(void* p_UserArgs)
return;
}

// Set our running state
s_LogManager->m_Running = true;

// Create our timeout
struct timeval s_Timeout
{
Expand Down Expand Up @@ -274,7 +277,7 @@ void LogManager::ServerThread(void* p_UserArgs)
cleanup:
// Disconnects all clients, set running to false
WriteLog(LL_Debug, "logserver tearing down");
s_LogManager->Teardown();
kclose_t(s_LogDevice, s_MainThread);

WriteLog(LL_Debug, "logserver exiting cleanly");
kthread_exit();
Expand Down