NLog.Internal.NetworkSenders.NetworkSender.Close C# (CSharp) Method

Close() public method

Closes the sender and releases any unmanaged resources.
public Close ( AsyncContinuation continuation ) : void
continuation AsyncContinuation The continuation.
return void
        public void Close(AsyncContinuation continuation)
        {
            this.DoClose(continuation);
        }

Usage Example

Example #1
0
        private void ReleaseCachedConnection(NetworkSender sender)
        {
            lock (this.currentSenderCache)
            {
                lock (this.openNetworkSenders)
                {
                    if (this.openNetworkSenders.Remove(sender))
                    {
                        // only remove it once
                        sender.Close(ex => { });
                    }
                }

                NetworkSender sender2;

                // make sure the current sender for this address is the one we want to remove
                if (this.currentSenderCache.TryGetValue(sender.Address, out sender2))
                {
                    if (ReferenceEquals(sender, sender2))
                    {
                        this.currentSenderCache.Remove(sender.Address);
                    }
                }
            }
        }