Example #1
0
        virtual internal void OnRemoteDisconnecting(INetworkNode Remote)
        {
            if ((RemoteDisconnecting == null) || (Remote == null))
            {
                return;
            }

            Task.Run(() =>
            {
                RemoteDisconnecting?.Invoke(this, new InternetConnectionEventArgs
                {
                    Local  = this,
                    Remote = Remote
                });
            });
        }
Example #2
0
        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); });
        }