diff --git a/src/windows/wsladiag/wsladiag.cpp b/src/windows/wsladiag/wsladiag.cpp index e09ad0d..d31f382 100644 --- a/src/windows/wsladiag/wsladiag.cpp +++ b/src/windows/wsladiag/wsladiag.cpp @@ -8,7 +8,7 @@ Module Name: Abstract: - TODO + Entry point for the wsladiag tool, performs WSL runtime initialization and parses --list/--help. --*/ diff --git a/src/windows/wslaservice/exe/WSLASession.cpp b/src/windows/wslaservice/exe/WSLASession.cpp index baf52d8..3d911d5 100644 --- a/src/windows/wslaservice/exe/WSLASession.cpp +++ b/src/windows/wslaservice/exe/WSLASession.cpp @@ -24,10 +24,7 @@ using wsl::windows::service::wsla::WSLAVirtualMachine; WSLASession::WSLASession(ULONG id, const WSLA_SESSION_SETTINGS& Settings, WSLAUserSessionImpl& userSessionImpl) : - m_id(id), - m_sessionSettings(Settings), - m_userSession(&userSessionImpl), - m_displayName(Settings.DisplayName) + m_id(id), m_sessionSettings(Settings), m_userSession(&userSessionImpl), m_displayName(Settings.DisplayName) { WSL_LOG("SessionCreated", TraceLoggingValue(m_displayName.c_str(), "DisplayName")); @@ -185,12 +182,6 @@ void WSLASession::ConfigureStorage(const WSLA_SESSION_SETTINGS& Settings) deleteVhdOnFailure.release(); } -HRESULT WSLASession::GetDisplayName(LPWSTR* DisplayName) -{ - RETURN_HR_IF_NULL(E_POINTER, DisplayName); - return wil::make_cotaskmem_string_nothrow(m_displayName.c_str(), DisplayName); -} - void WSLASession::CopyDisplayName(_Out_writes_z_(bufferLength) PWSTR buffer, size_t bufferLength) const { THROW_HR_IF(E_BOUNDS, m_displayName.size() + 1 > bufferLength); diff --git a/src/windows/wslaservice/exe/WSLAUserSession.cpp b/src/windows/wslaservice/exe/WSLAUserSession.cpp index c558485..35a58eb 100644 --- a/src/windows/wslaservice/exe/WSLAUserSession.cpp +++ b/src/windows/wslaservice/exe/WSLAUserSession.cpp @@ -27,7 +27,7 @@ WSLAUserSessionImpl::~WSLAUserSessionImpl() // In case there are still COM references on sessions, signal that the user session is terminating // so the sessions are all in a 'terminated' state. { - std::lock_guard lock(m_lock); + std::lock_guard lock(m_wslaSessionsLock); for (auto& e : m_sessions) { @@ -38,7 +38,7 @@ WSLAUserSessionImpl::~WSLAUserSessionImpl() void WSLAUserSessionImpl::OnSessionTerminated(WSLASession* Session) { - std::lock_guard lock(m_lock); + std::lock_guard lock(m_wslaSessionsLock); WI_VERIFY(m_sessions.erase(Session) == 1); } @@ -51,7 +51,7 @@ HRESULT WSLAUserSessionImpl::CreateSession(const WSLA_SESSION_SETTINGS* Settings { ULONG id = m_nextSessionId++; auto session = wil::MakeOrThrow(id, *Settings, *this); - + std::lock_guard lock(m_wslaSessionsLock); auto it = m_sessions.emplace(session.Get()); @@ -65,7 +65,7 @@ HRESULT WSLAUserSessionImpl::CreateSession(const WSLA_SESSION_SETTINGS* Settings HRESULT WSLAUserSessionImpl::OpenSessionByName(LPCWSTR DisplayName, IWSLASession** Session) { - std::lock_guard lock(m_lock); + std::lock_guard lock(m_wslaSessionsLock); // TODO: ACL check // TODO: Check for duplicate on session creation. @@ -83,7 +83,7 @@ HRESULT WSLAUserSessionImpl::OpenSessionByName(LPCWSTR DisplayName, IWSLASession HRESULT wsl::windows::service::wsla::WSLAUserSessionImpl::ListSessions(_Out_ WSLA_SESSION_INFORMATION** Sessions, _Out_ ULONG* SessionsCount) { - std::lock_guard lock(m_lock); + std::lock_guard lock(m_wslaSessionsLock); auto output = wil::make_unique_cotaskmem(m_sessions.size()); size_t index = 0; diff --git a/src/windows/wslaservice/exe/WSLAUserSession.h b/src/windows/wslaservice/exe/WSLAUserSession.h index 4c0df92..1ef6b13 100644 --- a/src/windows/wslaservice/exe/WSLAUserSession.h +++ b/src/windows/wslaservice/exe/WSLAUserSession.h @@ -43,7 +43,7 @@ private: wil::unique_tokeninfo_ptr m_tokenInfo; std::atomic m_nextSessionId{1}; - std::recursive_mutex m_lock; + std::recursive_mutex m_wslaSessionsLock; // TODO-WSLA: Consider using a weak_ptr to easily destroy when the last client reference is released. std::unordered_set m_sessions;