kern: update port/session state semantics
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user