Skip to content

Commit e9b2d0a

Browse files
committed
More error checks
1 parent 251542c commit e9b2d0a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Libuv/PipeServer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,20 @@ public PipeServer(Action<PipeSocket> callback)
2626
{
2727
this.callback = callback;
2828
this._handle = Marshal.AllocHGlobal(Sizes.PipeT);
29-
uv_pipe_init(this._handle);
29+
Util.CheckError(uv_pipe_init(this._handle));
3030
var handle = (uv_handle_t)Marshal.PtrToStructure(this._handle, typeof(uv_handle_t));
3131
this.me = GCHandle.Alloc(this);
3232
handle.data = GCHandle.ToIntPtr(this.me);
3333
Marshal.StructureToPtr(handle, this._handle, true);
3434
}
3535
public void Listen(string endpoint)
3636
{
37-
uv_pipe_bind(this._handle, endpoint);
38-
uv_listen(this._handle, 128, unmanaged_callback);
37+
Util.CheckError(uv_pipe_bind(this._handle, endpoint));
38+
Util.CheckError(uv_listen(this._handle, 128, unmanaged_callback));
3939
}
4040
public static void StaticCallback(IntPtr server_ptr, int status)
4141
{
42+
Util.CheckError(status);
4243
var handle = (uv_handle_t)Marshal.PtrToStructure(server_ptr, typeof(uv_handle_t));
4344
var instance = GCHandle.FromIntPtr(handle.data);
4445
var server = (PipeServer)instance.Target;

src/Libuv/TcpServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void Listen(IPEndPoint endpoint)
4242
}
4343
public static void StaticCallback(IntPtr server_ptr, int status)
4444
{
45+
Util.CheckError(status);
4546
var handle = (uv_handle_t)Marshal.PtrToStructure(server_ptr, typeof(uv_handle_t));
4647
var instance = GCHandle.FromIntPtr(handle.data);
4748
var server = (TcpServer)instance.Target;

0 commit comments

Comments
 (0)