From 7dc0a8c7bdccfc027b05434c2b5fce9237ec9025 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Thu, 25 Aug 2016 07:58:36 +0100 Subject: [PATCH] Return count from trywrite --- .../Internal/Networking/Libuv.cs | 6 ++++-- .../Internal/Networking/UvStreamHandle.cs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs index 986b406003..9c918491cc 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs @@ -313,10 +313,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking } protected Func _uv_try_write; - public void try_write(UvStreamHandle handle, uv_buf_t[] bufs, int nbufs) + public int try_write(UvStreamHandle handle, uv_buf_t[] bufs, int nbufs) { handle.Validate(); - ThrowIfErrored(_uv_try_write(handle, bufs, nbufs)); + var count = _uv_try_write(handle, bufs, nbufs); + ThrowIfErrored(count); + return count; } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvStreamHandle.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvStreamHandle.cs index 32604a08ce..698a693c60 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvStreamHandle.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvStreamHandle.cs @@ -118,9 +118,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking _uv.read_stop(this); } - public void TryWrite(Libuv.uv_buf_t buf) + public int TryWrite(Libuv.uv_buf_t buf) { - _uv.try_write(this, new[] { buf }, 1); + return _uv.try_write(this, new[] { buf }, 1); } private static void UvConnectionCb(IntPtr handle, int status)