mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-21 12:16:02 +08:00
use raw buffer for frist connect msg then use buffered stream to read more efficient
This commit is contained in:
@@ -393,6 +393,8 @@ namespace MQTTnet.Core.Tests
|
||||
|
||||
public Stream ReceiveStream => _stream;
|
||||
|
||||
public Stream RawStream => _stream;
|
||||
|
||||
public Stream SendStream => _stream;
|
||||
|
||||
public bool IsConnected { get; } = true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MQTTnet.Core.Adapter;
|
||||
using MQTTnet.Core.Client;
|
||||
@@ -46,6 +47,11 @@ namespace MQTTnet.Core.Tests
|
||||
return Task.Run(() => _incomingPackets.Take());
|
||||
}
|
||||
|
||||
public IEnumerable<MqttBasePacket> ReceivePackets( CancellationToken cancellationToken )
|
||||
{
|
||||
return _incomingPackets.GetConsumingEnumerable();
|
||||
}
|
||||
|
||||
private void SendPacketInternal(MqttBasePacket packet)
|
||||
{
|
||||
if (packet == null) throw new ArgumentNullException(nameof(packet));
|
||||
|
||||
Reference in New Issue
Block a user