diff --git a/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs b/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs index 01658a8..24afd14 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs @@ -446,6 +446,7 @@ namespace Capnp.Net.Runtime.Tests Assert.IsTrue(resolving.WhenResolved.Wait(MediumNonDbgTimeout)); var cap = new TestCallOrderImpl(); + cap.CountToDispose = 6; var earlyCall = main.GetCallSequence(0, default); diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs index 54ceedf..8678ca1 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs @@ -193,9 +193,19 @@ namespace Capnp.Rpc try { - if (!_acceptorThread.Join(500)) + try { - Logger.LogError("Unable to join TCP acceptor thread within timeout"); + if (!_acceptorThread.Join(500)) + { + Logger.LogError("Unable to join TCP acceptor thread within timeout"); + } + } + catch (ThreadStateException) + { + } + catch (System.Exception exception) + { + Logger.LogError($"Unable to join TCP acceptor thread: {exception.Message}"); } } catch (ThreadStateException)