Ejemplo n.º 1
0
        public void StartNewSession(string clientcode, ClientTypeCode clienttypecode, string clientname, string clientip,
                                    string clientmac, string clientSessionAppKey,
                                    string clientSessionUserDomainName, string clientSessionClientVersion, string clientSessionServiceId, string clientOSVersion)
        {
            var clientSessionId = CurrentSessionId;

            StartSession(clientcode: clientcode, clienttypecode: clienttypecode, clientip: clientip,
                         clientmac: clientmac, clientSessionAppKey: clientSessionAppKey,
                         clientSessionId: ref clientSessionId,
                         clientSessionUserDomainName: clientSessionUserDomainName, clientSessionClientVersion: clientSessionClientVersion,
                         clientSessionServiceId: clientSessionServiceId, clientOSVersion: clientOSVersion);
        }
Ejemplo n.º 2
0
 public void StartSession(string clientcode, ClientTypeCode clienttypecode, string clientip, string clientmac,
                          string clientSessionAppKey, ref decimal?clientSessionId,
                          string clientSessionUserDomainName, string clientSessionClientVersion, string clientSessionServiceId, string clientOSVersion)
 {
     using (var repo = GetRepository <IClientSessionRepository>())
         repo.StartSession(clientcode: clientcode, clienttypecode: clienttypecode.ToString(), clientip: clientip,
                           clientmac: clientmac, clientSessionAppKey: clientSessionAppKey,
                           clientSessionId: ref clientSessionId,
                           clientSessionUserDomainName: clientSessionUserDomainName, clientSessionClientVersion: clientSessionClientVersion,
                           clientSessionServiceId: clientSessionServiceId, clientOSVersion: clientOSVersion);
     CurrentClientCode = clientcode;
     CurrentSessionId  = clientSessionId;
     ClientType        = clienttypecode;
 }
Ejemplo n.º 3
0
        public virtual string StartSession(ClientTypeCode clientType, decimal?clientSessionId)
        {
            SessionCount++;

            _sessionId = OperationContext.Current.SessionId;
            _channel   = OperationContext.Current.Channel;

            _clienttype            = clientType;
            _clientSessionId       = clientSessionId;
            _isClientSessionIdNull = false;
            //TEST: Тестируем RCL
            if (_clienttype == ClientTypeCode.RCL && _clientSessionId.HasValue)
            {
                try
                {
                    var sessionRegistrator = IoC.Instance.Resolve <ISessionRegistrator>();
                    sessionRegistrator.ReopenSession(_clientSessionId.Value);
                }
                catch (Exception ex)
                {
                    Log.Error(string.Format("Error on reopen ClientSession ('{0}')", _clientSessionId), ex);
                }
            }

            _channel.Closed += Channel_Closed;

            //INFO: пока отключили контроль количества клиентов
            //if (SessionCount > Properties.Settings.Default.MaxConnections)
            //{
            //    SessionCount--;
            //    Log.DebugFormat("Client session '{0}' rejected. Max session count is {1}", _sessionId, Properties.Settings.Default.MaxConnections);
            //    throw new FaultException("Превышено максимальное количество сессий");
            //}
            _channelTimeout = Properties.Settings.Default.ChannelTimeout > 0
                ? Properties.Settings.Default.ChannelTimeout
                : DefaultChannelTimeout;

            Log.DebugFormat("Client session '{0}' started. Total sessions count {1}", _sessionId, SessionCount);
            _channelTimer.Change(_channelTimeout, _channelTimeout);
            return(_sessionId);
        }
Ejemplo n.º 4
0
        public WmsServiceClient(ClientTypeCode clientType, string serviceEndpoint)
        {
            // по умолчанию sessionId берем по номеру процесса
            // TODO: переделать на уникальный номер (лучше Guid); Как вариант можно завязаться на железные параметры и построить на этом одну из проверок лицензионности
            Session = System.Diagnostics.Process.GetCurrentProcess().Id;

            // вычитываем идентификатор сервиса (по умолчанию DCL)
            // решили пока использовать Guid
            ServiceId  = Guid.NewGuid().ToString();
            ClientName = string.Format("{0}_{1}", ServiceId, Session);

            ClientType = clientType;
            EndPoint   = serviceEndpoint;

            var manager    = new TerminalServicesManager();
            var rdpsession = manager.CurrentSession;

            HostName   = rdpsession.ClientName;
            IpAddress  = rdpsession.ClientIPAddress.To <string>();
            MacAddress = GetMacAdressByIp(rdpsession.ClientIPAddress);

            if (string.IsNullOrEmpty(HostName)) //HACK: Если не удалось получить данные удаленной сессии, определяем по-умолчанию
            {
                SetDefaultClientSystemProperty();
            }

            _switchEndpoint   = true;
            _retryPolicyCount = Properties.Settings.Default.RetryPolicyCount > 0
                ? Properties.Settings.Default.RetryPolicyCount
                : DefaultRetryPolicyCount;

            _retryPolicyTime = Properties.Settings.Default.RetryPolicyTime > 0
                ? Properties.Settings.Default.RetryPolicyTime
                : DefaultRetryPolicyTime;

            IsConnected = false;

            _authenticationProvider = IoC.Instance.Resolve <IAuthenticationProvider>();
            _authenticationProvider.AuthenticatedUserChanging += OnAuthenticatedUserChanging;
            _authenticationProvider.AuthenticatedUserChanged  += OnAuthenticatedUserChanged;
        }
Ejemplo n.º 5
0
 public string StartSession(ClientTypeCode clientType, decimal?clientSessionId)
 {
     return(Channel.StartSession(clientType, clientSessionId));
 }