public Parcel()
{
- Interop.LibRPCPort.Parcel.Create(out _handle);
+ var r = Interop.LibRPCPort.Parcel.Create(out _handle);
+ if (r != Interop.LibRPCPort.ErrorCode.None)
+ throw new InvalidIOException();
}
public Parcel(Port port)
{
- Interop.LibRPCPort.Parcel.CreateFromPort(out _handle, port.Handle);
+ var r = Interop.LibRPCPort.Parcel.CreateFromPort(out _handle, port.Handle);
+ if (r != Interop.LibRPCPort.ErrorCode.None)
+ throw new InvalidIOException();
}
public void Send(Port p)
{
- Interop.LibRPCPort.Parcel.Send(_handle, p.Handle);
+ var r = Interop.LibRPCPort.Parcel.Send(_handle, p.Handle);
+ if (r != Interop.LibRPCPort.ErrorCode.None)
+ throw new InvalidIOException();
}
public void WriteByte(byte b)
R"__cs_cb(
protected override bool OnReceivedEvent(string sender, string instance, Port port)
{
- using (var p = new Parcel(port))
+ var p = new Parcel(port);
+
+ try
{
ServiceBase b = null;
return true;
}
+ catch (InvalidIOException)
+ {
+ return false;
+ }
+ finally
+ {
+ p.Dispose();
+ }
}
)__cs_cb";