示例#1
0
        // ReSharper disable once UnusedMember.Global
        public async Task <bool> AwaitDisconnected()
        {
            var awaiter = new NotifyAwaiter <bool>();

            clientDisconnectedAwaiters.Enqueue(awaiter);
            return(await awaiter);
        }
        public async Task <bool> AwaitClientDisconnected(string identity)
        {
            if (!clientDisconnectedAwaiters.TryGetValue(identity, out var queue))
            {
                queue = new Queue <NotifyAwaiter <bool> >();
                clientDisconnectedAwaiters.Add(identity, queue);
            }

            var awaiter = new NotifyAwaiter <bool>();

            queue.Enqueue(awaiter);
            return(await awaiter);
        }