Skip to content

Commit d2c98bc

Browse files
committed
fixed an issue on session sharing, was in read-only mode instead of granted control (thanks medfki)
improved cleanup of guest(s) on session disconnect
1 parent f975d1b commit d2c98bc

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2019-11-09 Version 2.7.0 (stable)
1+
2019-11-19 Version 2.7.0 (stable)
22
* 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
33
updated readme and documentation about the RDS role
44
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)

Myrtille.Web/Default.aspx.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ protected void Page_Load(
243243

244244
// cleanup
245245
Session.Remove(HttpSessionStateVariables.RemoteSession.ToString());
246+
if (Session[HttpSessionStateVariables.GuestInfo.ToString()] != null)
247+
{
248+
Session.Remove(HttpSessionStateVariables.GuestInfo.ToString());
249+
}
246250
RemoteSession = null;
247251
}
248252
}

Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,39 @@ public void ProcessExited(int exitCode)
228228
remoteSessions.Remove(_remoteSessionManager.RemoteSession.Id);
229229
}
230230

231+
// retrieve the remote session guest(s)
232+
var guests = new List<SharingInfo>();
233+
var sharedSessions = (IDictionary<Guid, SharingInfo>)_application[HttpApplicationStateVariables.SharedRemoteSessions.ToString()];
234+
foreach (var sharingInfo in sharedSessions.Values)
235+
{
236+
if (sharingInfo.RemoteSession.Id.Equals(_remoteSessionManager.RemoteSession.Id))
237+
{
238+
guests.Add(sharingInfo);
239+
}
240+
}
241+
242+
// remove them
243+
foreach (var guest in guests)
244+
{
245+
if (guest.GuestInfo.Active && guest.HttpSession != null)
246+
{
247+
if (guest.HttpSession[HttpSessionStateVariables.RemoteSession.ToString()] != null)
248+
{
249+
guest.HttpSession.Remove(HttpSessionStateVariables.RemoteSession.ToString());
250+
}
251+
252+
if (guest.HttpSession[HttpSessionStateVariables.GuestInfo.ToString()] != null)
253+
{
254+
guest.HttpSession.Remove(HttpSessionStateVariables.GuestInfo.ToString());
255+
}
256+
257+
if (guest.RemoteSession.ActiveGuests > 0)
258+
{
259+
guest.RemoteSession.ActiveGuests--;
260+
}
261+
}
262+
sharedSessions.Remove(guest.GuestInfo.Id);
263+
}
231264

232265
// recycle the application pool when there is no active remote session
233266
bool idleAppPoolRecycling;

Myrtille.Web/src/RemoteSessionManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ public void ProcessInputs(HttpSessionState session, string data)
544544
{
545545
lock (_guestsIdleTimeoutLock)
546546
{
547+
if (!_guestsIdleTimeout.ContainsKey(session.SessionID))
548+
{
549+
_guestsIdleTimeout.Add(session.SessionID, new CancellationTokenSource());
550+
}
551+
547552
var guestIdleTimeout = _guestsIdleTimeout[session.SessionID];
548553
if (guestIdleTimeout != null)
549554
{

0 commit comments

Comments
 (0)