mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
- fix for issue #33
- turn on XML documentation generator - documentation fixes
This commit is contained in:
parent
5f97d69f79
commit
982eaa10dd
@ -20,6 +20,7 @@
|
||||
<PackageTags>capnp "Cap'n Proto" RPC serialization cerealization</PackageTags>
|
||||
<Version>1.2-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm))</Version>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
|
@ -186,6 +186,10 @@ namespace Capnp
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attaches an observer for tracing RPC traffic
|
||||
/// </summary>
|
||||
/// <param name="tracer">observer implementation</param>
|
||||
public void AttachTracer(IFrameTracer tracer)
|
||||
{
|
||||
_tracers.Add(tracer);
|
||||
|
@ -1,17 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Capnp.FrameTracing
|
||||
{
|
||||
/// <summary>
|
||||
/// Send or receive
|
||||
/// </summary>
|
||||
public enum FrameDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Receive direction
|
||||
/// </summary>
|
||||
Rx,
|
||||
|
||||
/// <summary>
|
||||
/// Send direction
|
||||
/// </summary>
|
||||
Tx
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client interface for observing RPC traffic
|
||||
/// </summary>
|
||||
public interface IFrameTracer: IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Called whenever an RPC frame was sent or received
|
||||
/// </summary>
|
||||
/// <param name="direction">frame direction</param>
|
||||
/// <param name="frame">actual frame</param>
|
||||
void TraceFrame(FrameDirection direction, WireFrame frame);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,9 @@ using System.Threading;
|
||||
|
||||
namespace Capnp.FrameTracing
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of an RPC observer
|
||||
/// </summary>
|
||||
public class RpcFrameTracer : IFrameTracer
|
||||
{
|
||||
const string Header = "Ticks | Thread | Dir | Message";
|
||||
@ -16,12 +19,19 @@ namespace Capnp.FrameTracing
|
||||
readonly Stopwatch _timer = new Stopwatch();
|
||||
readonly TextWriter _traceWriter;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance
|
||||
/// </summary>
|
||||
/// <param name="traceWriter">textual logging target</param>
|
||||
public RpcFrameTracer(TextWriter traceWriter)
|
||||
{
|
||||
_traceWriter = traceWriter ?? throw new ArgumentNullException(nameof(traceWriter));
|
||||
_traceWriter.WriteLine(Header);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose pattern implementation
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_traceWriter.WriteLine("<end of trace>");
|
||||
@ -91,6 +101,11 @@ namespace Capnp.FrameTracing
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes a sent or received RPC frame
|
||||
/// </summary>
|
||||
/// <param name="dir">frame direction</param>
|
||||
/// <param name="frame">actual frame</param>
|
||||
public void TraceFrame(FrameDirection dir, WireFrame frame)
|
||||
{
|
||||
if (!_timer.IsRunning)
|
||||
|
@ -43,7 +43,6 @@
|
||||
/// <param name="interfaceId">Target interface ID</param>
|
||||
/// <param name="methodId">Target method ID</param>
|
||||
/// <param name="args">Method arguments</param>
|
||||
/// <param name="tailCall">Whether it is a tail call</param>
|
||||
/// <returns>Answer promise</returns>
|
||||
public IPromisedAnswer Call(ulong interfaceId, ushort methodId, DynamicSerializerState args)
|
||||
{
|
||||
|
@ -281,7 +281,6 @@ namespace Capnp.Rpc.Interception
|
||||
/// <summary>
|
||||
/// Forwards this intercepted call to the target capability ("Bob").
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Optional cancellation token, requesting Bob to cancel the call</param>
|
||||
public void ForwardToBob()
|
||||
{
|
||||
if (Bob == null)
|
||||
|
@ -4,16 +4,24 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Capnp.Rpc
|
||||
{
|
||||
/// <summary>
|
||||
/// Carries information on RPC connection state changes.
|
||||
/// </summary>
|
||||
public class ConnectionEventArgs: EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Affected connection
|
||||
/// </summary>
|
||||
public IConnection Connection { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance
|
||||
/// </summary>
|
||||
/// <param name="connection">RPC connection object</param>
|
||||
public ConnectionEventArgs(IConnection connection)
|
||||
{
|
||||
Connection = connection;
|
||||
|
@ -9015,7 +9015,7 @@ namespace Capnproto_test.Capnp.Test
|
||||
where TT : class where TU : class
|
||||
{
|
||||
var in_ = CapnpSerializable.Create<Capnproto_test.Capnp.Test.TestImplicitMethodParams.Params_call<TT, TU>>(d_);
|
||||
return Impatient.MaybeTailCall(Impl.Call(in_.Foo, in_.Bar, cancellationToken_), r_ =>
|
||||
return Impatient.MaybeTailCall(Impl.Call<TT, TU>(in_.Foo, in_.Bar, cancellationToken_), r_ =>
|
||||
{
|
||||
var s_ = SerializerState.CreateForRpc<Capnproto_test.Capnp.Test.TestGenerics<TT, TU>.WRITER>();
|
||||
r_.serialize(s_);
|
||||
@ -9142,7 +9142,7 @@ namespace Capnproto_test.Capnp.Test
|
||||
where TT : class where TU : class
|
||||
{
|
||||
var in_ = CapnpSerializable.Create<Capnproto_test.Capnp.Test.TestImplicitMethodParamsInGeneric<TV>.Params_call<TT, TU>>(d_);
|
||||
return Impatient.MaybeTailCall(Impl.Call(in_.Foo, in_.Bar, cancellationToken_), r_ =>
|
||||
return Impatient.MaybeTailCall(Impl.Call<TT, TU>(in_.Foo, in_.Bar, cancellationToken_), r_ =>
|
||||
{
|
||||
var s_ = SerializerState.CreateForRpc<Capnproto_test.Capnp.Test.TestGenerics<TT, TU>.WRITER>();
|
||||
r_.serialize(s_);
|
||||
|
@ -551,11 +551,26 @@ namespace CapnpC.CSharp.Generator.CodeGen
|
||||
|
||||
IEnumerable<StatementSyntax> MakeSkeletonMethodBody(Method method)
|
||||
{
|
||||
SimpleNameSyntax methodName;
|
||||
|
||||
if (method.GenericParameters.Count == 0)
|
||||
{
|
||||
methodName = _names.GetCodeIdentifier(method).IdentifierName;
|
||||
}
|
||||
else
|
||||
{
|
||||
methodName = GenericName(_names.GetCodeIdentifier(method).Identifier)
|
||||
.AddTypeArgumentListArguments(
|
||||
method.GenericParameters.Select(
|
||||
p => _names.GetGenericTypeParameter(p).IdentifierName)
|
||||
.ToArray());
|
||||
}
|
||||
|
||||
var call = InvocationExpression(
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName(SkeletonWorder.ImplName),
|
||||
_names.GetCodeIdentifier(method).IdentifierName));
|
||||
methodName));
|
||||
|
||||
if (method.Params.Count > 0)
|
||||
{
|
||||
|
11
MsBuildGenerationTest/Issue33.capnp
Normal file
11
MsBuildGenerationTest/Issue33.capnp
Normal file
@ -0,0 +1,11 @@
|
||||
@0xaa62d76b329585e5;
|
||||
|
||||
interface Frobnicator(T)
|
||||
{
|
||||
frobnicate @0 (value: T);
|
||||
}
|
||||
|
||||
interface FrobnicatorFactory
|
||||
{
|
||||
createFrobnicator @0 [T] (id: Text) -> (result: Frobnicator(T));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user