Sfoglia il codice sorgente

fixed index out of range

release/3.x.x
Jan Eggers 7 anni fa
parent
commit
d594b1447f
2 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. +1
    -0
      Frameworks/MQTTnet.NetStandard/Implementations/WebSocketStream.cs
  2. +2
    -1
      Frameworks/MQTTnet.UniversalWindows/Implementations/WebSocketStream.cs

+ 1
- 0
Frameworks/MQTTnet.NetStandard/Implementations/WebSocketStream.cs Vedi File

@@ -41,6 +41,7 @@ namespace MQTTnet.Implementations
{
var response = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer, currentOffset, count), cancellationToken).ConfigureAwait(false);
currentOffset += response.Count;
count -= response.Count;

if (response.MessageType == WebSocketMessageType.Close)
{


+ 2
- 1
Frameworks/MQTTnet.UniversalWindows/Implementations/WebSocketStream.cs Vedi File

@@ -27,7 +27,8 @@ namespace MQTTnet.Implementations
{
var response = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer, currentOffset, count), cancellationToken).ConfigureAwait(false);
currentOffset += response.Count;
count -= response.Count;

if (response.MessageType == WebSocketMessageType.Close)
{
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, cancellationToken).ConfigureAwait(false);


Caricamento…
Annulla
Salva