diff --git a/Benchmarking/NuGet.Config b/Benchmarking/NuGet.Config
new file mode 100644
index 0000000..3f0e003
--- /dev/null
+++ b/Benchmarking/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Capnp.Net.Runtime/Rpc/RefCountingCapability.cs b/Capnp.Net.Runtime/Rpc/RefCountingCapability.cs
index 695a91c..e64378c 100644
--- a/Capnp.Net.Runtime/Rpc/RefCountingCapability.cs
+++ b/Capnp.Net.Runtime/Rpc/RefCountingCapability.cs
@@ -29,8 +29,8 @@ namespace Capnp.Rpc
#if DebugCapabilityLifecycle
ILogger Logger { get; } = Logging.CreateLogger();
- string _releasingMethodName;
- string _releasingFilePath;
+ string? _releasingMethodName;
+ string? _releasingFilePath;
int _releasingLineNumber;
#endif
diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs
index dcd05fc..dcdb9fb 100644
--- a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs
+++ b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs
@@ -60,6 +60,7 @@ namespace Capnp.Rpc
class Connection: IConnection
{
+ readonly List _tracers = new List();
readonly TcpRpcServer _server;
Stream _stream;
@@ -73,6 +74,13 @@ namespace Capnp.Rpc
public void Start()
{
Pump = new FramePump(_stream);
+
+ foreach (var tracer in _tracers)
+ {
+ Pump.AttachTracer(tracer);
+ }
+ _tracers.Clear();
+
OutboundEp = new OutboundTcpEndpoint(_server, Pump);
InboundEp = _server._rpcEngine.AddEndpoint(OutboundEp);
Pump.FrameReceived += InboundEp.Forward;
@@ -106,16 +114,16 @@ namespace Capnp.Rpc
public ConnectionState State { get; set; } = ConnectionState.Initializing;
public TcpClient Client { get; private set; }
- public FramePump Pump { get; private set; }
- public OutboundTcpEndpoint OutboundEp { get; private set; }
- public RpcEngine.RpcEndpoint InboundEp { get; private set; }
+ public FramePump? Pump { get; private set; }
+ public OutboundTcpEndpoint? OutboundEp { get; private set; }
+ public RpcEngine.RpcEndpoint? InboundEp { get; private set; }
public Thread? PumpRunner { get; private set; }
public int? LocalPort => ((IPEndPoint)Client.Client.LocalEndPoint)?.Port;
public int? RemotePort => ((IPEndPoint)Client.Client.RemoteEndPoint)?.Port;
- public long RecvCount => InboundEp.RecvCount;
- public long SendCount => InboundEp.SendCount;
+ public long RecvCount => InboundEp?.RecvCount ?? 0;
+ public long SendCount => InboundEp?.SendCount ?? 0;
public bool IsComputing => PumpRunner?.ThreadState == ThreadState.Running;
- public bool IsWaitingForData => Pump.IsWaitingForData;
+ public bool IsWaitingForData => Pump?.IsWaitingForData ?? false;
public void AttachTracer(IFrameTracer tracer)
{
@@ -125,7 +133,7 @@ namespace Capnp.Rpc
if (State != ConnectionState.Initializing)
throw new InvalidOperationException("Connection is not in state 'Initializing'");
- Pump.AttachTracer(tracer);
+ _tracers.Add(tracer);
}
///
@@ -248,7 +256,7 @@ namespace Capnp.Rpc
foreach (var connection in connections)
{
connection.Client.Dispose();
- connection.Pump.Dispose();
+ connection.Pump?.Dispose();
SafeJoin(connection.PumpRunner);
}