Example #1
0
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            await ConnectionsLock.TryLockAsync(
                async() =>
            {
                foreach (var connection in _connections)
                {
                    ClearListeners(connection);
                    await connection.DisposeAsync();
                }

                _connections.Clear();
            },
                5000,
                true);

            _isDisposed = true;

            await base.DisposeAsync(disposing);
        }
Example #2
0
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            await ConnectionsLock.TryLockAsync(
                async() =>
            {
                if (HostServer != null)
                {
                    await HostServer.DisposeAsync();
                    HostServer = null;
                }
            },
                5000,
                true);

            await base.DisposeAsync(disposing);
        }