public ClientRequestManager() { ClientRequestConfig config = new ClientRequestConfig { ShouldRetryOnError = true, RequestedSystem = 0 }; this.m_defaultConfig = config; this.m_state = new InternalState(); this.m_subscribePacket = new Subscribe(); }
private bool SendClientRequestImpl(int type, IProtoBuf body, ClientRequestConfig clientRequestConfig, RequestPhase requestPhase, int subID) { if (type == 0) { return(false); } if ((requestPhase < RequestPhase.STARTUP) || (requestPhase > RequestPhase.RUNNING)) { return(false); } ClientRequestConfig config = (clientRequestConfig != null) ? clientRequestConfig : this.m_defaultConfig; int requestedSystem = config.RequestedSystem; SystemChannel orCreateSystem = this.GetOrCreateSystem(requestedSystem); if (requestPhase < orCreateSystem.CurrentPhase) { return(false); } if (orCreateSystem.WasEverInRunningPhase && (requestPhase < RequestPhase.RUNNING)) { return(false); } if (body == null) { return(false); } ClientRequestType item = new ClientRequestType { Type = type, ShouldRetryOnError = config.ShouldRetryOnError, SubID = subID, Body = ProtobufUtil.ToByteArray(body), Phase = requestPhase, RetryCount = 0, RequestId = this.GetNextRequestId() }; if (item.Phase == RequestPhase.STARTUP) { orCreateSystem.Phases.StartUp.PendingSend.Enqueue(item); } else { orCreateSystem.Phases.Running.PendingSend.Enqueue(item); } return(true); }
public bool SendClientRequest(int type, IProtoBuf body, ClientRequestConfig clientRequestConfig, RequestPhase requestPhase = 1, int subID = 0) { return(this.SendClientRequestImpl(type, body, clientRequestConfig, requestPhase, subID)); }