System.Net.Sockets.SafeCloseSocket.InnerSafeCloseSocket.ReleaseHandle C# (CSharp) Method

ReleaseHandle() protected method

protected ReleaseHandle ( ) : bool
return bool
            protected override bool ReleaseHandle()
            {
                bool ret = false;

#if DEBUG
                try
                {
#endif
                    if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"handle:{handle}");

                    SocketError errorCode = InnerReleaseHandle();
                    return ret = errorCode == SocketError.Success;
#if DEBUG
                }
                catch (Exception exception)
                {
                    if (!ExceptionCheck.IsFatal(exception))
                    {
                        NetEventSource.Fail(this, $"handle:{handle}, error:{exception}");
                    }

                    ret = true;  // Avoid a second assert.
                    throw;
                }
                finally
                {
                    _closeSocketThread = Environment.CurrentManagedThreadId;
                    _closeSocketTick = Environment.TickCount;
                    if (!ret)
                    {
                        NetEventSource.Fail(this, $"ReleaseHandle failed. handle:{handle}");
                    }
                }
#endif
            }