Пример #1
0
        void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                if (_host != null)
                {
                    _host.Stop();
                    _host.Dispose();
                    _host = null;
                }

                if (_connections != null)
                {
                    _connections.Each(x =>
                    {
                        try
                        {
                            x.Dispose();
                        }
                        catch (Exception ex)
                        {
                            _log.Error("Closing connection caused an exception", ex);
                        }
                    });
                    _connections = null;
                }
            }

            _disposed = true;
        }