Ejemplo n.º 1
0
        private void InternalDispose(bool isDispose)
        {
            if (_disposed)
            {
                return;
            }

            if (isDispose)
            {
                GC.SuppressFinalize(this);
            }

            _disposed = true;

            TryCancelLinger();

            var res = Native.Socket.zmq_close(this.SocketPtr);

            if (res == Native.ErrorCode)
            {
                // we cannot throw in dispose.
                var msg = "Error disposing socket: " + Native.LastErrorString();
                System.Diagnostics.Trace.TraceError(msg);
                System.Diagnostics.Debug.WriteLine(msg);
                if (LogAdapter.LogEnabled)
                {
                    LogAdapter.LogError("Socket", msg);
                }
            }

#if DEBUG
            _context.Untrack(this);
#endif
        }