/// <summary> /// To call the event <see cref="Connector.Disconnected"/>. /// </summary> private void RaiseDisconnected() { // адаптеры маркет-данных сами должны оповещать коннектор //if (!IsMarketDataIndependent) // RaiseExportStopped(); ConnectionState = ConnectionStates.Disconnected; Disconnected.SafeInvoke(); }
/// <summary> /// Called when this connector has been disconnected from Prepar3D. /// Handle the base call after the derived classes stuff if you need simulation_connection to be valid. /// </summary> protected virtual void OnDisconnected() { // Stop the message pump thread. message_thread.Abort(); // Since we are no longer processing messages, close the connection to the simulation. simulation_connection.Dispose(); message_pump.Dispose(); // Reset the state of the data model. Reset(); // Send the disconnected event. Disconnected.SafeInvoke(this, EventArgs.Empty); }
private void OnConnectionDisconnected(object sender, EventArgs e) { Log.LogInfo("[Peer] Disconnected from {0}", endPoint); if (connection != null) { UninitializeConnection(connection); connection.Dispose(); connection = null; } if (torrent != null) { torrent.OnPeerDisconnected(this); } Disconnected.SafeInvoke(this, e); }
private void OnConnectionChanged(eConnectionState state) { try { _adapter.AddInfoLog("OnConnectionChanged {0}", state); switch (state) { case eConnectionState.Connected: _connState = ConnectionStates.Connected; Connected.SafeInvoke(); break; case eConnectionState.Disconnected: if (_connState == ConnectionStates.Disconnecting) { Disconnected.SafeInvoke(); } else { ConnectionError.SafeInvoke(new AlfaException(tagStateCodes.stcNotConnected, LocalizedStrings.Str1611)); } _connState = ConnectionStates.Disconnected; break; default: ConnectionError.SafeInvoke(new InvalidOperationException("Error eConnectionState: " + state)); break; } } catch (Exception e) { _adapter.AddErrorLog(LocalizedStrings.Str2273Params, e); Error.SafeInvoke(e); } }
public void Disconnect(Socket localSocket, Exception reason) { lock (_disconnectionSyncObj) { if (!_isDisconnecting) { _isDisconnecting = true; } else { Logg("Отключение уже выполняется, отмена"); return; // уже идет подключение, другие попытки параллельного подключения отбрасываются } } Logg("Disconnect > до начала отключения число подключений = " + _connectionCounter.Count); try { Logg("Отключение по причине: " + reason); localSocket.Disconnect(true); Logg("Отключено"); } catch (Exception ex) { Logg("Ошибка при отключении" + ex); lock (_disconnectionSyncObj) { _isDisconnecting = false; } } finally { _connectionCounter.DecrementCount(); _notifyThreadWorker.AddWork(() => Disconnected.SafeInvoke(this, new DisconnectedEventArgs(reason))); } }
private void RaiseDisconnected(Exception error) { _errorWhileDisconnect = error != null; Disconnected.SafeInvoke(error); }
private void DisconnectedHandler() { AddGuiAction(() => Disconnected.SafeInvoke()); }
/// <summary> /// The peer connection has been disconnected. /// </summary> protected virtual void OnDisconnected() { Disconnected.SafeInvoke(this, EventArgs.Empty); }
protected virtual void OnDisconnected(EventArgs e) { Disconnected.SafeInvoke(this, e); }
private void LinkOnDisconnected(object sender, DisconnectedEventArgs eventArgs) { Disconnected.SafeInvoke(this, eventArgs); }