public RemoteSessionManager(RemoteSession remoteSession)
        {
            try
            {
                RemoteSession = remoteSession;

                // remote session process client and callback
                var callback        = new RemoteSessionProcessClientCallback(this);
                var callbackContext = new InstanceContext(callback);
                Client = new RemoteSessionProcessClient(this, callbackContext);

                // pipes
                Pipes = new RemoteSessionPipes(RemoteSession);
                Pipes.ProcessUpdatesPipeMessage = ProcessUpdatesPipeMessage;

                // sockets
                WebSockets = new List <RemoteSessionSocketHandler>();

                // messages
                _messageEventLock = new object();

                // images
                _imageEventLock = new object();

                // cache
                _imageCache = (Cache)HttpContext.Current.Application[HttpApplicationStateVariables.Cache.ToString()];
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to initialize remote session manager, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }
        public RemoteSessionManager(RemoteSession remoteSession)
        {
            try
            {
                RemoteSession = remoteSession;

                // remote session process client and callback
                var callback        = new RemoteSessionProcessClientCallback(this);
                var callbackContext = new InstanceContext(callback);
                HostClient = new RemoteSessionProcessClient(this, callbackContext);

                // pipes
                Pipes = new RemoteSessionPipes(RemoteSession);
                Pipes.ProcessUpdatesPipeMessage = ProcessUpdatesPipeMessage;

                // audio (RDP only)
                if (RemoteSession.HostType == HostType.RDP)
                {
                    Pipes.ProcessAudioPipeMessage = ProcessAudioPipeMessage;
                }

                // sockets
                WebSockets      = new List <RemoteSessionSocketHandler>();
                AudioWebSockets = new List <RemoteSessionAudioSocketHandler>();

                // messages
                MessageQueues = new Hashtable();

                // images event
                _imageEventLock = new object();

                // cache
                _cache = (Cache)HttpContext.Current.Application[HttpApplicationStateVariables.Cache.ToString()];

                // owner idle timeout
                if (!int.TryParse(ConfigurationManager.AppSettings["ClientIdleTimeout"], out _clientIdleTimeoutDelay))
                {
                    _clientIdleTimeoutDelay = 0;
                }

                if (_clientIdleTimeoutDelay > 0)
                {
                    ClientIdleTimeout = new CancellationTokenSource();
                }

                // guests idle timeout
                _guestsIdleTimeout     = new Dictionary <string, CancellationTokenSource>();
                _guestsIdleTimeoutLock = new object();
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to initialize remote session manager, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }
Esempio n. 3
0
        public RemoteSessionManager(RemoteSession remoteSession)
        {
            try
            {
                RemoteSession = remoteSession;

                // remote session process client and callback
                var callback        = new RemoteSessionProcessClientCallback(this);
                var callbackContext = new InstanceContext(callback);
                HostClient = new RemoteSessionProcessClient(this, callbackContext);

                // pipes
                Pipes = new RemoteSessionPipes(RemoteSession);
                Pipes.ProcessUpdatesPipeMessage = ProcessUpdatesPipeMessage;

                // sockets
                WebSockets = new List <RemoteSessionSocketHandler>();

                // messages
                MessageQueues = new Hashtable();

                // images event
                _imageEventLock = new object();

                // images cache
                _imageCache = (Cache)HttpContext.Current.Application[HttpApplicationStateVariables.Cache.ToString()];

                // browser resize
                if (!bool.TryParse(ConfigurationManager.AppSettings["ScaleOnResize"], out _scaleOnResize))
                {
                    _scaleOnResize = true;
                }

                if (!_scaleOnResize)
                {
                    _reconnectTimeout = new CancellationTokenSource();
                }

                // browser timeout
                if (!int.TryParse(ConfigurationManager.AppSettings["ClientIdleTimeout"], out _clientIdleTimeoutDelay))
                {
                    _clientIdleTimeoutDelay = 0;
                }

                if (_clientIdleTimeoutDelay > 0)
                {
                    ClientIdleTimeout = new CancellationTokenSource();
                }
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to initialize remote session manager, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }
Esempio n. 4
0
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     if (RemoteSessionPipes != null)
     {
         RemoteSessionPipes.DeletePipes();
     }
     if (WebSocket != null)
     {
         WebSocket.Close();
         WebSocket = null;
     }
 }
Esempio n. 5
0
        public RemoteSessionManager(RemoteSession remoteSession)
        {
            try
            {
                RemoteSession = remoteSession;

                // remote session process client and callback
                var callback        = new RemoteSessionProcessClientCallback(this, HttpContext.Current.Application);
                var callbackContext = new InstanceContext(callback);
                HostClient = new RemoteSessionProcessClient(this, callbackContext);

                // clients
                Clients     = new Dictionary <string, RemoteSessionClient>();
                ClientsLock = new object();

                // pipes
                Pipes = new RemoteSessionPipes(RemoteSession);

                // images event
                _imageEventLock = new object();

                // cache
                _cache = (Cache)HttpContext.Current.Application[HttpApplicationStateVariables.Cache.ToString()];

                // owner idle timeout
                if (!int.TryParse(ConfigurationManager.AppSettings["OwnerIdleTimeout"], out _ownerIdleTimeoutDelay))
                {
                    _ownerIdleTimeoutDelay = 0;
                }

                if (_ownerIdleTimeoutDelay > 0)
                {
                    OwnerIdleTimeout = new CancellationTokenSource();
                }

                // guests idle timeout
                _guestsIdleTimeout     = new Dictionary <string, CancellationTokenSource>();
                _guestsIdleTimeoutLock = new object();

                // clients idle timeout
                _clientsIdleTimeout     = new Dictionary <string, CancellationTokenSource>();
                _clientsIdleTimeoutLock = new object();
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to initialize remote session manager, remote session {0} ({1})", RemoteSession?.Id, exc);
            }
        }