示例#1
0
        public async Task SendAsync(IPacket packet)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            byte[] bytes = await _manager.GetBytesAsync(packet);

            _sender.OnNext(packet);

            await _innerChannel.SendAsync(bytes);
        }
        public async Task SendAsync(IPacket packet)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            var bytes = await manager.GetBytesAsync(packet)
                        .ConfigureAwait(continueOnCapturedContext: false);

            sender.OnNext(packet);

            await innerChannel.SendAsync(bytes)
            .ConfigureAwait(continueOnCapturedContext: false);
        }