mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 09:13:02 +08:00
Fixed latent bug in MqttApplicationMessageBuilder.WithPayload stream overload (#1322)
This commit is contained in:
@@ -159,7 +159,18 @@ namespace MQTTnet
|
||||
else
|
||||
{
|
||||
_payload = new byte[length];
|
||||
payload.Read(_payload, 0, _payload.Length);
|
||||
|
||||
var totalRead = 0;
|
||||
do
|
||||
{
|
||||
var bytesRead = payload.Read(_payload, totalRead, _payload.Length - totalRead);
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
totalRead += bytesRead;
|
||||
}
|
||||
while (totalRead < length);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user