Skip to content

Commit

Permalink
MNTR fix from akkadotnet#4139
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorFedchenko committed Jan 9, 2020
1 parent f1a044d commit f1c5386
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/Akka.NodeTestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,32 @@ private static Assembly DefaultOnResolving(AssemblyLoadContext assemblyLoadConte

class RunnerTcpClient : ReceiveActor, IWithUnboundedStash
{
private IActorRef _connection;

public RunnerTcpClient()
{
Become(WaitingForConnection);
}

/// <inheritdoc />
protected override void PostStop()
{
// Close connection property to avoid exception logged at TcpConnection actor once this actor is terminated
try
{
_connection.Ask<Tcp.Closed>(Tcp.Close.Instance, TimeSpan.FromSeconds(1)).Wait();
}
catch { /* well... at least we have tried */ }

base.PostStop();
}

private void WaitingForConnection()
{
Receive<Tcp.Connected>(connected =>
{
Sender.Tell(new Tcp.Register(Self));
_connection = Sender;
Become(Connected(Sender));
});
Receive<string>(_ => Stash.Stash());
Expand Down

0 comments on commit f1c5386

Please sign in to comment.