kern: update port/session state semantics

This commit is contained in:
Michael Scire
2021-04-07 14:45:38 -07:00
committed by SciresM
parent c62a7381f8
commit cbdf33260e
7 changed files with 32 additions and 11 deletions

View File

@@ -42,6 +42,10 @@ namespace ams::kern {
return this->GetParent()->IsLight();
}
bool KClientPort::IsServerClosed() const {
return this->GetParent()->IsServerClosed();
}
void KClientPort::Destroy() {
/* Note with our parent that we're closed. */
m_parent->OnClientClosed();

View File

@@ -40,7 +40,7 @@ namespace ams::kern {
KServerSession *session = nullptr;
{
KScopedSchedulerLock sl;
while (!m_session_list.empty()) {
if (!m_session_list.empty()) {
session = std::addressof(m_session_list.front());
m_session_list.pop_front();
}
@@ -60,7 +60,7 @@ namespace ams::kern {
KLightServerSession *session = nullptr;
{
KScopedSchedulerLock sl;
while (!m_light_session_list.empty()) {
if (!m_light_session_list.empty()) {
session = std::addressof(m_light_session_list.front());
m_light_session_list.pop_front();
}

View File

@@ -35,7 +35,7 @@ namespace ams::kern {
m_client.Initialize(this);
/* Set state and name. */
m_state = State::Normal;
this->SetState(State::Normal);
m_name = name;
/* Set our owner process. */
@@ -62,8 +62,8 @@ namespace ams::kern {
void KSession::OnServerClosed() {
MESOSPHERE_ASSERT_THIS();
if (m_state == State::Normal) {
m_state = State::ServerClosed;
if (this->GetState() == State::Normal) {
this->SetState(State::ServerClosed);
m_client.OnServerClosed();
}
}
@@ -71,8 +71,8 @@ namespace ams::kern {
void KSession::OnClientClosed() {
MESOSPHERE_ASSERT_THIS();
if (m_state == State::Normal) {
m_state = State::ClientClosed;
if (this->GetState() == State::Normal) {
this->SetState(State::ClientClosed);
m_server.OnClientClosed();
}
}