Kaynağa Gözat

generate exception in case websocket is closed so stream does not return array of 255

release/3.x.x
Jan Eggers 7 yıl önce
ebeveyn
işleme
e80d21e852
2 değiştirilmiş dosya ile 12 ekleme ve 0 silme
  1. +6
    -0
      Frameworks/MQTTnet.NetStandard/Implementations/WebSocketStream.cs
  2. +6
    -0
      Frameworks/MQTTnet.UniversalWindows/Implementations/WebSocketStream.cs

+ 6
- 0
Frameworks/MQTTnet.NetStandard/Implementations/WebSocketStream.cs Dosyayı Görüntüle

@@ -3,6 +3,7 @@ using System.IO;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using MQTTnet.Core.Exceptions;

namespace MQTTnet.Implementations
{
@@ -49,6 +50,11 @@ namespace MQTTnet.Implementations
}
}

if (_webSocket.State == WebSocketState.Closed)
{
throw new MqttCommunicationException( "connection closed" );
}

return currentOffset - offset;
}



+ 6
- 0
Frameworks/MQTTnet.UniversalWindows/Implementations/WebSocketStream.cs Dosyayı Görüntüle

@@ -3,6 +3,7 @@ using System.IO;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using MQTTnet.Core.Exceptions;

namespace MQTTnet.Implementations
{
@@ -35,6 +36,11 @@ namespace MQTTnet.Implementations
}
}

if (_webSocket.State == WebSocketState.Closed)
{
throw new MqttCommunicationException("connection closed");
}

return currentOffset - offset;
}



Yükleniyor…
İptal
Kaydet