/// <summary> /// The OnSessionStopped event handler is invoked in response /// to the underlying FIX session being shutdown. /// </summary> /// <param name="session"> /// The FIX session that the event relates to. /// </param> public void OnSessionClosed(IVfxFixSession session) { lock (_synch) { _fixApplication.OnSessionClosed(_appSession); // REC: If the service is being closed and the FIX session // has just stopped, then the IPC handler can be shutdown: if (_serviceState == VfxFixServiceStates.Service_State_Closing) { _ipcEndpoint.Shutdown(); } } }
/// <summary> /// The OnSessionStopped callback method is invoked in response /// to an instance of a session being shutdown. /// </summary> /// <param name="session"> /// The FIX session that the event relates to. /// </param> public void OnSessionClosed(IVfxFixSession session) { // REC: Determine which application session corresponds to // the FIX session that the event is coming from and route // the appropriate notification to it. if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionClosed(appSession); } // REC: If there is currently an IPC session in place // that corresponds to the FIX session, it needs to be // disconnected at this point: if (_mapFixToIpc.ContainsKey(session.InstanceId)) { _endpoint.Shutdown(_mapFixToIpc[session.InstanceId]); } else { // REC: Since the FIX session has been closed, it can // be removed from the active sessions map: if (_mapFixSessions.ContainsKey(session.InstanceId)) { _mapFixSessions.Remove(session.InstanceId); } } if (_serviceState == VfxFixServiceStates.Service_State_Closing) { if (_mapFixSessions.Count == 0) { // REC: Adjust the service's state: _serviceState = VfxFixServiceStates.Service_State_Closed; // REC: Adjust the service's status: _serviceStatus = VfxFixServiceStatus.Service_Status_Closed; // REC: Dispatch the closed event: EventHandler <VfxFixServiceEventArgs> tmpDispatch = EventDispatch; if (tmpDispatch != null) { VfxFixServiceEventArgs args = new VfxFixServiceEventArgs(VfxFixServiceEventTypes.Event_Service_Stopped, _serviceStatus); tmpDispatch(this, args); } } } }