Example #1
0
        public InitCommand(string clientid, string id)
        {
            _initCommand                = new Common.Protobuf.InitCommand();
            name                        = "InitCommand";
            _currentVersion             = Common.ProductVersion.ProductInfo;
            _initCommand.cacheId        = id;
            _initCommand.clientId       = clientid;
            _initCommand.isDotnetClient = true;
            _initCommand.requestId      = RequestId;

            if (_initCommand.productVersion == null)
            {
                _initCommand.productVersion = new Common.Protobuf.ProductVersion();
            }
            _initCommand.productVersion.AddiotionalData = _currentVersion.AdditionalData;
            _initCommand.productVersion.EditionID       = _currentVersion.EditionID;
            _initCommand.productVersion.MajorVersion1   = HelperFxn.ParseToByteArray(_currentVersion.MajorVersion1);
            _initCommand.productVersion.MajorVersion2   = HelperFxn.ParseToByteArray(_currentVersion.MajorVersion2);
            _initCommand.productVersion.MinorVersion1   = HelperFxn.ParseToByteArray(_currentVersion.MinorVersion1);
            _initCommand.productVersion.MinorVersion2   = HelperFxn.ParseToByteArray(_currentVersion.MinorVersion2);
            _initCommand.productVersion.ProductName     = _currentVersion.ProductName;


            _initCommand.clientVersion = 4610;
        }
Example #2
0
        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Common.Protobuf.InitCommand initCommand = command.initCommand;

            cmdInfo.CacheId  = initCommand.cacheId;
            cmdInfo.ClientID = initCommand.clientId;

            cmdInfo.IsDotNetClient = initCommand.isDotnetClient;
            cmdInfo.LicenceCode    = initCommand.licenceCode;

            cmdInfo.RequestId           = initCommand.requestId.ToString();
            cmdInfo.clientVersion       = initCommand.clientVersion;
            cmdInfo.clientIP            = initCommand.clientIP;
            cmdInfo.isAzureClient       = initCommand.isAzureClient;
            clientManager.ClientIP      = initCommand.clientIP;
            clientManager.IsAzureClient = initCommand.isAzureClient;

            return(cmdInfo);
        }
Example #3
0
        public override void ProcessCommand(ClientManager clientManager, object cmd, long acknowledgementId, UsageStats stats)
        {
            Common.Protobuf.Command command = cmd as Common.Protobuf.Command;
            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "enter");
            }
            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "" + command);
            }
            if (SocketServer.Logger.IsDetailedLogsEnabled)
            {
                SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " COMMAND to be executed : " + command.type.ToString() + " RequestId :" + command.requestID);
            }

            HPTimeStats milliSecWatch = new HPTimeStats();

            milliSecWatch.BeginSample();

            CommandBase incommingCmd = null;

            switch (command.type)
            {
            case Common.Protobuf.Command.Type.INIT:
                Common.Protobuf.InitCommand initCommand = command.initCommand;
                initCommand.requestId = command.requestID;
                incommingCmd          = new ServiceInitializeCommand(acknowledgementId);
                break;

            case Common.Protobuf.Command.Type.GET_OPTIMAL_SERVER:
                command.getOptimalServerCommand.requestId = command.requestID;
                incommingCmd = new ServiceGetOptimalServerCommand(acknowledgementId);
                break;

            case Common.Protobuf.Command.Type.GET_CACHE_BINDING:
                command.getCacheBindingCommand.requestId = command.requestID;
                incommingCmd = new ServiceCacheBindingCommand(acknowledgementId);
                break;

            case Common.Protobuf.Command.Type.GET_SERVER_MAPPING:
                command.getServerMappingCommand.requestId = command.requestID;
                incommingCmd = new GetServerMappingCommand();
                break;
            }


            if (SocketServer.IsServerCounterEnabled)
            {
                base.PerfStatsCollector.MsecPerCacheOperationBeginSample();
            }
            try
            {
                incommingCmd.ExecuteCommand(clientManager, command);
            }
            catch (Exception ex)
            {
                throw;
            }
            if (SocketServer.Logger.IsDetailedLogsEnabled)
            {
                SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " after executing COMMAND : " + command.type.ToString() + " RequestId :" + command.requestID);
            }


            if (SocketServer.IsServerCounterEnabled)
            {
                base.PerfStatsCollector.MsecPerCacheOperationEndSample();
            }


            if (clientManager != null && incommingCmd.SerializedResponsePackets != null && !clientManager.IsCacheStopped)
            {
                if (SocketServer.IsServerCounterEnabled)
                {
                    base.PerfStatsCollector.IncrementResponsesPerSecStats(1);
                }

                foreach (byte[] reponse in incommingCmd.SerializedResponsePackets)
                {
                    ConnectionManager.AssureSend(clientManager, reponse, Common.Enum.Priority.Normal);
                }
            }

            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "exit");
            }
        }