mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 19:58:57 +08:00
Fix wrong value for graceful socket close handling.
This commit is contained in:
@@ -239,19 +239,19 @@ namespace MQTTnet.Adapter
|
|||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var readCount = await _channel.ReadAsync(_singleByteBuffer, 0, 1, cancellationToken).ConfigureAwait(false);
|
var readCount = await _channel.ReadAsync(_singleByteBuffer, 0, 1, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readCount == 0)
|
if (readCount == 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_packetInspector?.FillReceiveBuffer(_singleByteBuffer);
|
_packetInspector?.FillReceiveBuffer(_singleByteBuffer);
|
||||||
@@ -301,8 +301,7 @@ namespace MQTTnet.Adapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
var bodyLength = await ReadBodyLengthAsync(buffer[1], cancellationToken).ConfigureAwait(false);
|
var bodyLength = await ReadBodyLengthAsync(buffer[1], cancellationToken).ConfigureAwait(false);
|
||||||
|
if (bodyLength == 0)
|
||||||
if (bodyLength == -1)
|
|
||||||
{
|
{
|
||||||
return new ReadFixedHeaderResult
|
return new ReadFixedHeaderResult
|
||||||
{
|
{
|
||||||
@@ -336,10 +335,9 @@ namespace MQTTnet.Adapter
|
|||||||
return ReceivedMqttPacket.Empty;
|
return ReceivedMqttPacket.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsReadingPacket = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsReadingPacket = true;
|
|
||||||
|
|
||||||
var fixedHeader = readFixedHeaderResult.FixedHeader;
|
var fixedHeader = readFixedHeaderResult.FixedHeader;
|
||||||
if (fixedHeader.RemainingLength == 0)
|
if (fixedHeader.RemainingLength == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user