mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-11-05 14:02:55 +08:00
Merge branch 'master' into interceptor-undelivered
This commit is contained in:
@@ -16,7 +16,8 @@
|
|||||||
* [AspNetCore] Adjusted some namespaces (BREAKING CHANGE!)
|
* [AspNetCore] Adjusted some namespaces (BREAKING CHANGE!)
|
||||||
* [Server] Adjusted some namespaces (BREAKING CHANGE!)
|
* [Server] Adjusted some namespaces (BREAKING CHANGE!)
|
||||||
* [Server] Added state checks (throw if not started etc.) for most server APIs.
|
* [Server] Added state checks (throw if not started etc.) for most server APIs.
|
||||||
* [Server] Exposed real X509Certificate2 (instead byte array) to TLS options (Thanks to @borigas).
|
* [Server] Exposed real X509Certificate2 (instead byte array) to TLS options (thanks to @borigas).
|
||||||
|
* [Core] Fixed a null reference exception in the MqttTcpChannel with WriteAsync and ReadAsync.
|
||||||
* [Core] Added server interceptor for undelivered messages (Thanks to @cshark-inator).
|
* [Core] Added server interceptor for undelivered messages (Thanks to @cshark-inator).
|
||||||
</releaseNotes>
|
</releaseNotes>
|
||||||
<copyright>Copyright Christian Kratky 2016-2020</copyright>
|
<copyright>Copyright Christian Kratky 2016-2020</copyright>
|
||||||
|
|||||||
@@ -127,7 +127,14 @@ namespace MQTTnet.Implementations
|
|||||||
// Workaround for: https://github.com/dotnet/corefx/issues/24430
|
// Workaround for: https://github.com/dotnet/corefx/issues/24430
|
||||||
using (cancellationToken.Register(Dispose))
|
using (cancellationToken.Register(Dispose))
|
||||||
{
|
{
|
||||||
return await _stream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
|
var stream = _stream;
|
||||||
|
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException(nameof(stream));
|
||||||
|
}
|
||||||
|
|
||||||
|
return await stream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
@@ -157,7 +164,14 @@ namespace MQTTnet.Implementations
|
|||||||
// Workaround for: https://github.com/dotnet/corefx/issues/24430
|
// Workaround for: https://github.com/dotnet/corefx/issues/24430
|
||||||
using (cancellationToken.Register(Dispose))
|
using (cancellationToken.Register(Dispose))
|
||||||
{
|
{
|
||||||
await _stream.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
|
var stream = _stream;
|
||||||
|
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException(nameof(stream));
|
||||||
|
}
|
||||||
|
|
||||||
|
await stream.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
|
|||||||
Reference in New Issue
Block a user