mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-30 18:56:30 +08:00
enable abort exceptions
This commit is contained in:
@@ -131,14 +131,14 @@ namespace MQTTnet.AspNetCore.Client.Tcp
|
|||||||
if (!_aborted)
|
if (!_aborted)
|
||||||
{
|
{
|
||||||
// Calling Dispose after ReceiveAsync can cause an "InvalidArgument" error on *nix.
|
// Calling Dispose after ReceiveAsync can cause an "InvalidArgument" error on *nix.
|
||||||
//error = new MqttCommunicationException();
|
error = ConnectionAborted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
if (!_aborted)
|
if (!_aborted)
|
||||||
{
|
{
|
||||||
//error = new MqttCommunicationException();
|
error = ConnectionAborted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
@@ -153,7 +153,7 @@ namespace MQTTnet.AspNetCore.Client.Tcp
|
|||||||
{
|
{
|
||||||
if (_aborted)
|
if (_aborted)
|
||||||
{
|
{
|
||||||
//error = error ?? new MqttCommunicationException();
|
error = error ?? ConnectionAborted();
|
||||||
}
|
}
|
||||||
|
|
||||||
_application.Output.Complete(error);
|
_application.Output.Complete(error);
|
||||||
@@ -193,6 +193,11 @@ namespace MQTTnet.AspNetCore.Client.Tcp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Exception ConnectionAborted()
|
||||||
|
{
|
||||||
|
return new MqttCommunicationException("Connection Aborted");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<Exception> DoSend()
|
private async Task<Exception> DoSend()
|
||||||
{
|
{
|
||||||
Exception error = null;
|
Exception error = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user