Fix disposal of SSL streams.

This commit is contained in:
Christian Kratky
2019-04-03 23:45:53 +02:00
parent a8db0dd3d6
commit cdeb073bb0
8 changed files with 156 additions and 124 deletions
+7 -3
View File
@@ -283,15 +283,19 @@ namespace MQTTnet.Adapter
private static bool IsWrappedException(Exception exception)
{
return exception is TaskCanceledException ||
exception is OperationCanceledException ||
return exception is OperationCanceledException ||
exception is MqttCommunicationTimedOutException ||
exception is MqttCommunicationException;
}
private static void WrapException(Exception exception)
{
if (exception is IOException && exception.InnerException is SocketException socketException)
if (exception is IOException && exception.InnerException is SocketException innerException)
{
exception = innerException;
}
if (exception is SocketException socketException)
{
if (socketException.SocketErrorCode == SocketError.ConnectionAborted ||
socketException.SocketErrorCode == SocketError.OperationAborted)
@@ -5,12 +5,12 @@ namespace MQTTnet.Adapter
{
public class MqttServerAdapterClientAcceptedEventArgs : EventArgs
{
public MqttServerAdapterClientAcceptedEventArgs(IMqttChannelAdapter client)
public MqttServerAdapterClientAcceptedEventArgs(IMqttChannelAdapter channelAdapter)
{
Client = client ?? throw new ArgumentNullException(nameof(client));
ChannelAdapter = channelAdapter ?? throw new ArgumentNullException(nameof(channelAdapter));
}
public IMqttChannelAdapter Client { get; }
public IMqttChannelAdapter ChannelAdapter { get; }
public Task SessionTask { get; set; }
}