diff --git a/build/dependencies.props b/build/dependencies.props
index 0365181477..3d317ffde2 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -28,18 +28,17 @@
2.1.0-preview3-32037
2.1.0-preview3-32037
2.0.0
- 2.1.0-preview2-26314-02
2.1.0-preview3-32037
+ 2.1.0-preview3-26331-01
15.6.1
4.7.49
- 11.0.1
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
- 4.5.0-preview2-26313-01
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
+ 4.5.0-preview3-26331-02
0.8.0
2.3.1
2.4.0-beta.1.build3945
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index a1676ede80..6b85b2cf04 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -6,4 +6,8 @@
+
+
+ false
+
diff --git a/src/Kestrel.Transport.Libuv/Internal/LibuvConnection.cs b/src/Kestrel.Transport.Libuv/Internal/LibuvConnection.cs
index 00844e73a3..21e3a6805e 100644
--- a/src/Kestrel.Transport.Libuv/Internal/LibuvConnection.cs
+++ b/src/Kestrel.Transport.Libuv/Internal/LibuvConnection.cs
@@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
private unsafe LibuvFunctions.uv_buf_t OnAlloc(UvStreamHandle handle, int suggestedSize)
{
var currentWritableBuffer = Input.GetMemory(MinAllocBufferSize);
- _bufferHandle = currentWritableBuffer.Retain(true);
+ _bufferHandle = currentWritableBuffer.Pin();
return handle.Libuv.buf_init((IntPtr)_bufferHandle.Pointer, currentWritableBuffer.Length);
}
@@ -118,6 +118,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
private void OnRead(UvStreamHandle handle, int status)
{
+ // Cleanup state from last OnAlloc. This is safe even if OnAlloc wasn't called.
+ _bufferHandle.Dispose();
if (status == 0)
{
// EAGAIN/EWOULDBLOCK so just return the buffer.
@@ -168,9 +170,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
// Complete after aborting the connection
Input.Complete(error);
}
-
- // Cleanup state from last OnAlloc. This is safe even if OnAlloc wasn't called.
- _bufferHandle.Dispose();
}
private async Task ApplyBackpressureAsync(ValueTask flushTask)
diff --git a/src/Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs b/src/Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs
index 9a635ba5cc..e28c318616 100644
--- a/src/Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs
+++ b/src/Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs
@@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin
if (nBuffers == 1)
{
var memory = buffer.First;
- var memoryHandle = memory.Retain(true);
+ var memoryHandle = memory.Pin();
_handles.Add(memoryHandle);
// Fast path for single buffer
@@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin
foreach (var memory in buffer)
{
// This won't actually pin the buffer since we're already using pinned memory
- var memoryHandle = memory.Retain(true);
+ var memoryHandle = memory.Pin();
_handles.Add(memoryHandle);
// create and pin each segment being written
diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs b/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs
index 0f73ad2571..a8b66a579c 100644
--- a/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs
+++ b/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs
@@ -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)
{
diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs
index 150978e473..2116c03cd5 100644
--- a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs
+++ b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs
@@ -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();
+ }
}
}
diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs b/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs
index a8b0727c0a..26e22b664d 100644
--- a/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs
+++ b/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs
@@ -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();
+ }
}
}