diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/LibuvAwaitable.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/LibuvAwaitable.cs index 5c038a4456..7029a1c32e 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/LibuvAwaitable.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/LibuvAwaitable.cs @@ -15,11 +15,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal private Action _callback; - private Exception _exception; + private UvException _exception; private int _status; - public static readonly Action Callback = (req, status, error, state) => + public static readonly Action Callback = (req, status, error, state) => { var awaitable = (LibuvAwaitable)state; @@ -71,9 +71,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal public struct UvWriteResult { public int Status { get; } - public Exception Error { get; } + public UvException Error { get; } - public UvWriteResult(int status, Exception error) + public UvWriteResult(int status, UvException error) { Status = status; Error = error; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Listener.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Listener.cs index c1c562c574..e5b0a267fa 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Listener.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Listener.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal } } - private static void ConnectionCallback(UvStreamHandle stream, int status, Exception error, object state) + private static void ConnectionCallback(UvStreamHandle stream, int status, UvException error, object state) { var listener = (Listener)state; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs index 7159d82c2c..d154d31d85 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal (pipe, status, error, state) => ((ListenerPrimary)state).OnListenPipe(pipe, status, error), this); } - private void OnListenPipe(UvStreamHandle pipe, int status, Exception error) + private void OnListenPipe(UvStreamHandle pipe, int status, UvException error) { if (status < 0) { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerSecondary.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerSecondary.cs index 4b43c9cf79..2571f6bb67 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerSecondary.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/ListenerSecondary.cs @@ -78,13 +78,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal } } - private static void ConnectCallback(UvConnectRequest connect, int status, Exception error, TaskCompletionSource tcs) + private static void ConnectCallback(UvConnectRequest connect, int status, UvException error, TaskCompletionSource tcs) { var listener = (ListenerSecondary)tcs.Task.AsyncState; listener.ConnectedCallback(connect, status, error, tcs); } - private async void ConnectedCallback(UvConnectRequest connect, int status, Exception error, TaskCompletionSource tcs) + private async void ConnectedCallback(UvConnectRequest connect, int status, UvException error, TaskCompletionSource tcs) { connect.Dispose(); if (error != null) @@ -133,8 +133,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal { if (status != LibuvConstants.EOF) { - Exception ex; - Thread.Loop.Libuv.Check(status, out ex); + Thread.Loop.Libuv.Check(status, out var ex); Log.LogError(0, ex, "DispatchPipe.ReadStart"); } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs index 84572dae53..06e7030bef 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin throw GetError(statusCode); } - public void Check(int statusCode, out Exception error) + public void Check(int statusCode, out UvException error) { // Note: method is explicitly small so the success case is easily inlined error = statusCode < 0 ? GetError(statusCode) : null; @@ -345,14 +345,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin protected delegate int uv_ip4_addr_func(string ip, int port, out SockAddr addr); protected uv_ip4_addr_func _uv_ip4_addr; - public void ip4_addr(string ip, int port, out SockAddr addr, out Exception error) + public void ip4_addr(string ip, int port, out SockAddr addr, out UvException error) { Check(_uv_ip4_addr(ip, port, out addr), out error); } protected delegate int uv_ip6_addr_func(string ip, int port, out SockAddr addr); protected uv_ip6_addr_func _uv_ip6_addr; - public void ip6_addr(string ip, int port, out SockAddr addr, out Exception error) + public void ip6_addr(string ip, int port, out SockAddr addr, out UvException error) { Check(_uv_ip6_addr(ip, port, out addr), out error); } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvConnectRequest.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvConnectRequest.cs index 0c0371e2bb..75c58b5434 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvConnectRequest.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvConnectRequest.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin { private readonly static LibuvFunctions.uv_connect_cb _uv_connect_cb = (req, status) => UvConnectCb(req, status); - private Action _callback; + private Action _callback; private object _state; public UvConnectRequest(ILibuvTrace logger) : base (logger) @@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin public void Connect( UvPipeHandle pipe, string name, - Action callback, + Action callback, object state) { _callback = callback; @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin var state = req._state; req._state = null; - Exception error = null; + UvException error = null; if (status < 0) { req.Libuv.Check(status, out error); diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvStreamHandle.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvStreamHandle.cs index 92663696ce..d847512fda 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvStreamHandle.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvStreamHandle.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin private readonly static LibuvFunctions.uv_alloc_cb _uv_alloc_cb = (IntPtr handle, int suggested_size, out LibuvFunctions.uv_buf_t buf) => UvAllocCb(handle, suggested_size, out buf); private readonly static LibuvFunctions.uv_read_cb _uv_read_cb = (IntPtr handle, int status, ref LibuvFunctions.uv_buf_t buf) => UvReadCb(handle, status, ref buf); - private Action _listenCallback; + private Action _listenCallback; private object _listenState; private GCHandle _listenVitality; @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin return base.ReleaseHandle(); } - public void Listen(int backlog, Action callback, object state) + public void Listen(int backlog, Action callback, object state) { if (_listenVitality.IsAllocated) { @@ -123,8 +123,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin { var stream = FromIntPtr(handle); - Exception error; - stream.Libuv.Check(status, out error); + stream.Libuv.Check(status, out var error); try { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs index 1e3a1409cd..7bb6e0e908 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs @@ -33,13 +33,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin SockAddr addr; var addressText = endPoint.Address.ToString(); - Exception error1; - _uv.ip4_addr(addressText, endPoint.Port, out addr, out error1); + _uv.ip4_addr(addressText, endPoint.Port, out addr, out var error1); if (error1 != null) { - Exception error2; - _uv.ip6_addr(addressText, endPoint.Port, out addr, out error2); + _uv.ip6_addr(addressText, endPoint.Port, out addr, out var error2); if (error2 != null) { throw error1; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs index ab14ffdf2b..05b60ca679 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin private IntPtr _bufs; - private Action _callback; + private Action _callback; private object _state; private const int BUFFER_COUNT = 4; @@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin private unsafe void Write( UvStreamHandle handle, ReadableBuffer buffer, - Action callback, + Action callback, object state) { try @@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin private void Write( UvStreamHandle handle, ArraySegment> bufs, - Action callback, + Action callback, object state) { WriteArraySegmentInternal(handle, bufs, sendHandle: null, callback: callback, state: state); @@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin UvStreamHandle handle, ArraySegment> bufs, UvStreamHandle sendHandle, - Action callback, + Action callback, object state) { WriteArraySegmentInternal(handle, bufs, sendHandle, callback, state); @@ -156,7 +156,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin UvStreamHandle handle, ArraySegment> bufs, UvStreamHandle sendHandle, - Action callback, + Action callback, object state) { try @@ -237,7 +237,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin var state = req._state; req._state = null; - Exception error = null; + UvException error = null; if (status < 0) { req.Libuv.Check(status, out error);