/// <summary> /// Call this function if you want to unlock this proxy for client use. /// </summary> /// <param name="incomingPackages">The incoming packages in this step.</param> /// <param name="state">The current state of the channel.</param> /// <remarks>Calling this function is only allowed on host side proxies.</remarks> public void UnlockForClient(RCPackage[] incomingPackages, DssChannelState state) { if (this.proxyMode == DssMode.HOST_SIDE) { if (this.accessDenied) { this.incomingPackages = incomingPackages; this.outgoingPackages = null; this.currentStateOfChannel = state; this.currentStateOfChannels = null; this.taskToPerform = DssChannelTask.NOT_SPECIFIED; this.accessDenied = false; } else { throw new DssException("DssChannelProxy already unlocked!"); } } else { throw new DssException("Proxy must be host side to call this function!"); } }
/// <summary> /// Sends the setup step requests to the guests, perform the tasks initiated by the client module and /// send the SMC to waiting state. /// </summary> private void ContinueSetup() { this.SetupStepTimerInactive_Running.Fire(); this.SendingSetupStepRQs_WaitingSetupStepAWs.Fire(); /// First handle the channels where drop happened. for (int i = 0; i < this.channelProxies.Length; i++) { if (this.channelProxies[i].TaskToPerform == DssChannelTask.DROP_AND_OPEN || this.channelProxies[i].TaskToPerform == DssChannelTask.DROP_AND_CLOSE) { /// Drop guest and close channel if necessary. this.channels[i].DropGuest(this.channelProxies[i].TaskToPerform == DssChannelTask.DROP_AND_OPEN); this.hostRoot.GuestLeftDss(i); } } /// Then handle any other channels. for (int i = 0; i < this.sessions.Length; i++) { if (this.channelProxies[i].TaskToPerform == DssChannelTask.CLOSE) { /// Close the channel. this.channels[i].CloseChannel(); } else if (this.channelProxies[i].TaskToPerform == DssChannelTask.OPEN) { /// Open the channel. this.channels[i].OpenChannel(); } else if (this.channelProxies[i].TaskToPerform != DssChannelTask.DROP_AND_OPEN && this.channelProxies[i].TaskToPerform != DssChannelTask.DROP_AND_CLOSE) { /// No task to perform on the channel just send the setup step request. if (this.channels[i].CurrentState == this.channels[i].Engaged) { SetupStep currStep = this.hostRoot.GetStep(i); if (currStep.State == SetupStepState.READY || currStep.State == SetupStepState.ERROR) { currStep.Reset(); } DssChannelState[] chStates = new DssChannelState[this.channels.Length]; for (int j = 0; j < channels.Length; j++) { if (this.channelProxies[j].TaskToPerform == DssChannelTask.OPEN || this.channelProxies[j].TaskToPerform == DssChannelTask.DROP_AND_OPEN) { chStates[j] = DssChannelState.CHANNEL_OPENED; } else if (this.channelProxies[j].TaskToPerform == DssChannelTask.CLOSE || this.channelProxies[j].TaskToPerform == DssChannelTask.DROP_AND_CLOSE) { chStates[j] = DssChannelState.CHANNEL_CLOSED; } else { if (this.channels[j].CurrentState == this.channels[j].Opened) { chStates[j] = DssChannelState.CHANNEL_OPENED; } else if (this.channels[j].CurrentState == this.channels[j].Closed) { chStates[j] = DssChannelState.CHANNEL_CLOSED; } else if (this.channels[j].CurrentState == this.channels[j].Engaged) { chStates[j] = DssChannelState.GUEST_CONNECTED; } else { throw new DssException("Unexpected channel state!"); } } } int[] leftList = null; int[] lostList = null; this.hostRoot.GetGuestEvents(out leftList, out lostList); RCPackage[] packagesToSend = currStep.CreateRequest(this.channelProxies[i].OutgoingPackages != null ? this.channelProxies[i].OutgoingPackages : new RCPackage[0] { }, leftList, lostList, chStates); foreach (RCPackage pckg in packagesToSend) { this.hostRoot.Lobby.SendControlPackage(pckg, i + 1); } this.sessions[i].SetupStepRequestSent(); } } } /// end-for (int i = 0; i < this.channelProxies.Length; i++) }