Dispose SocketAsyncEventArgs when we dispose the Socket (#2459)
This commit is contained in:
parent
ba2b883db0
commit
623c27ab01
|
|
@ -86,6 +86,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
// Dispose the socket(should noop if already called)
|
||||
_socket.Dispose();
|
||||
_receiver.Dispose();
|
||||
_sender.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Net.Sockets;
|
|||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||
{
|
||||
public class SocketReceiver
|
||||
public class SocketReceiver : IDisposable
|
||||
{
|
||||
private readonly Socket _socket;
|
||||
private readonly SocketAsyncEventArgs _eventArgs = new SocketAsyncEventArgs();
|
||||
|
|
@ -37,5 +37,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
return _awaitable;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_eventArgs.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||
{
|
||||
public class SocketSender
|
||||
public class SocketSender : IDisposable
|
||||
{
|
||||
private readonly Socket _socket;
|
||||
private readonly SocketAsyncEventArgs _eventArgs = new SocketAsyncEventArgs();
|
||||
|
|
@ -98,5 +98,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
return _bufferList;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_eventArgs.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue