Skip to content

Commit 32b869e

Browse files
committedFeb 12, 2015
Use the newest libuv and expose pipe_peername.
1 parent 0746988 commit 32b869e

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed
 

‎LibuvSharp/FileSystemWatcher.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void OnChange(string filename, FileSystemEvent @event)
7878

7979
public string Path {
8080
get {
81-
return UV.ToString(4096, (buffer, length) => uv_fs_event_getpath(NativeHandle, buffer, ref length)).TrimEnd('\0');
81+
return UV.ToString(4096, (buffer, length) => uv_fs_event_getpath(NativeHandle, buffer, ref length));
8282
}
8383
}
8484

‎LibuvSharp/Pipe.cs

+7-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void Bind(string name)
2424

2525
public string LocalAddress {
2626
get {
27-
return UV.ToString(4096, (buffer, length) => NativeMethods.uv_pipe_getsockname(NativeHandle, buffer, ref length)).TrimEnd('\0');
27+
return UV.ToString(4096, (buffer, length) => NativeMethods.uv_pipe_getsockname(NativeHandle, buffer, ref length));
2828
}
2929
}
3030
}
@@ -107,21 +107,15 @@ public void Connect(string name, Action<Exception> callback)
107107
cpr.Callback = (status, cpr2) => Ensure.Success(status, callback, name);
108108

109109
uv_pipe_connect(cpr.Handle, pipe.NativeHandle, name, ConnectRequest.CallbackDelegate);
110-
RemoteAddress = name;
111110
}
112111

113-
public string RemoteAddress { get; private set; }
114-
115-
protected override void OnComplete()
116-
{
117-
RemoteAddress = null;
118-
base.OnComplete();
119-
}
112+
[DllImport("uv", CallingConvention = CallingConvention.Cdecl)]
113+
static extern int uv_pipe_getpeername(IntPtr handle, IntPtr buf, ref IntPtr len);
120114

121-
protected override void OnError(Exception exception)
122-
{
123-
RemoteAddress = null;
124-
base.OnError(exception);
115+
public string RemoteAddress {
116+
get {
117+
return UV.ToString(4096, (buffer, length) => uv_pipe_getpeername(NativeHandle, buffer, ref length));
118+
}
125119
}
126120
}
127121

0 commit comments

Comments
 (0)
Please sign in to comment.