Skip to content

Commit

Permalink
fixed an issue on session sharing, was in read-only mode instead of g…
Browse files Browse the repository at this point in the history
…ranted control (thanks medfki)

improved cleanup of guest(s) on session disconnect
  • Loading branch information
cedrozor committed Nov 19, 2019
1 parent f975d1b commit d2c98bc
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2019-11-09 Version 2.7.0 (stable)
2019-11-19 Version 2.7.0 (stable)
* HOTFIX * fixed a critical issue with FreeRDP (exit code 131085) when using an RD license server configured in "per device" mode, past the 120 days of the RDS grace period
updated readme and documentation about the RDS role
the browser "heartbeat" (used to detect if the browser window/tab was closed) is now on a different timer than the periodical fullscreen update (config.js; default 10 secs)
Expand Down
4 changes: 4 additions & 0 deletions Myrtille.Web/Default.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ protected void Page_Load(

// cleanup
Session.Remove(HttpSessionStateVariables.RemoteSession.ToString());
if (Session[HttpSessionStateVariables.GuestInfo.ToString()] != null)
{
Session.Remove(HttpSessionStateVariables.GuestInfo.ToString());
}
RemoteSession = null;
}
}
Expand Down
33 changes: 33 additions & 0 deletions Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,39 @@ public void ProcessExited(int exitCode)
remoteSessions.Remove(_remoteSessionManager.RemoteSession.Id);
}

// retrieve the remote session guest(s)
var guests = new List<SharingInfo>();
var sharedSessions = (IDictionary<Guid, SharingInfo>)_application[HttpApplicationStateVariables.SharedRemoteSessions.ToString()];
foreach (var sharingInfo in sharedSessions.Values)
{
if (sharingInfo.RemoteSession.Id.Equals(_remoteSessionManager.RemoteSession.Id))
{
guests.Add(sharingInfo);
}
}

// remove them
foreach (var guest in guests)
{
if (guest.GuestInfo.Active && guest.HttpSession != null)
{
if (guest.HttpSession[HttpSessionStateVariables.RemoteSession.ToString()] != null)
{
guest.HttpSession.Remove(HttpSessionStateVariables.RemoteSession.ToString());
}

if (guest.HttpSession[HttpSessionStateVariables.GuestInfo.ToString()] != null)
{
guest.HttpSession.Remove(HttpSessionStateVariables.GuestInfo.ToString());
}

if (guest.RemoteSession.ActiveGuests > 0)
{
guest.RemoteSession.ActiveGuests--;
}
}
sharedSessions.Remove(guest.GuestInfo.Id);
}

// recycle the application pool when there is no active remote session
bool idleAppPoolRecycling;
Expand Down
5 changes: 5 additions & 0 deletions Myrtille.Web/src/RemoteSessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ public void ProcessInputs(HttpSessionState session, string data)
{
lock (_guestsIdleTimeoutLock)
{
if (!_guestsIdleTimeout.ContainsKey(session.SessionID))
{
_guestsIdleTimeout.Add(session.SessionID, new CancellationTokenSource());
}

var guestIdleTimeout = _guestsIdleTimeout[session.SessionID];
if (guestIdleTimeout != null)
{
Expand Down

0 comments on commit d2c98bc

Please sign in to comment.