Return count from trywrite

This commit is contained in:
Ben Adams 2016-08-25 07:58:36 +01:00
parent af73e519c1
commit 7dc0a8c7bd
2 changed files with 6 additions and 4 deletions

View File

@ -313,10 +313,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
}
protected Func<UvStreamHandle, uv_buf_t[], int, int> _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)]

View File

@ -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)