public override ReplyAllRGO ProcessData(RequestAllRGO Request) { log = log4net.LogManager.GetLogger("RGOServiceRGO"); var Reply = new ReplyAllRGO(); uint ID = Request.ClientID; if (!ClientSessions.ContainsKey(ID)) { return(null); } log.Debug($"Requested {Request.RequestIndex}"); int start = Math.Min(LocalRGOList.Count - 1, Request.RequestIndex); int nr = Math.Min(LocalRGOList.Count - start, ClientSessions[ID].BatchSize); if (nr == 0) { return(null); } Reply.Index = start; Reply.TotalNumber = LocalRGOList.Count; Reply.RGObjects = LocalRGOList.GetRange(start, nr); return(Reply); }
public override DescriptionReply ProcessData(DescriptionRequest Request) { var Reply = new DescriptionReply(); uint ID = Request.ClientID; if (!ClientSessions.ContainsKey(ID)) { return(null); } log.Debug($"Requested description {Request.RequestIndex}"); int start = Math.Min(LocalDict.Count - 1, Request.RequestIndex); int nr = Math.Min(LocalDict.Count - start, ClientSessions[ID].BatchSize); if (nr == 0) { return(null); } Reply.Index = start; Reply.TotalNumber = IDList.Count; Reply.Descriptions.Clear(); foreach (var I in IDList.GetRange(start, nr)) { Reply.Descriptions.Add(I, LocalDict[I]); } return(Reply); }
public override ServerInfo ProcessData(CClientInfo Request) { ServerInfo Reply = new ServerInfo(); uint ID = Request.ClientID; if (ClientSessions.ContainsKey(ID) == false) { if (ClientSessions.Count < RGOServiceBase.maxNrClients) { var clientConn = new RGOClientConnection(ID) { IsLocal = Connection.IsOnLoopback, BatchSize = RGOServiceBase.LocalBatchsize, ConnectionName = Connection.Address }; if (!Connection.IsOnLoopback) { clientConn.BatchSize = RGOServiceBase.RemoteBatchsize; } ClientSessions.Add(ID, clientConn); Reply.ConnectionAccepted = true; } else { Reply.ConnectionAccepted = false; } } else { ClientSessions[ID].ClientCommCounter = Request.Counter; log.Debug($"Client: {Request.ClientID}, counter:{Request.Counter}"); Reply.SetTime(); Reply.SessionCounter = Request.Counter; Reply.CycleTime = RGOServiceStarter.MeasuredCycleTime; Reply.ConnectionAccepted = true; } return(Reply); }