virtual internal void OnRemoteDisconnecting(INetworkNode Remote) { if ((RemoteDisconnecting == null) || (Remote == null)) { return; } Task.Run(() => { RemoteDisconnecting?.Invoke(this, new InternetConnectionEventArgs { Local = this, Remote = Remote }); }); }
private async void OnRemoteDisconnecting(INetworkNode Remote) { if ((RemoteDisconnecting == null) || (Remote == null)) { return; } // Invoke any waiting disconnect event handlers await Task.Run(() => { RemoteDisconnecting?.Invoke(this, new InternetConnectionEventArgs { Local = this, Remote = Remote }); }); // Actually disconnect the remote socket await Task.Run(() => { DoDisconnect(Remote); }); }