Skip to content

Commit e49973c

Browse files
committed
Try not to get stopped by death pact before Unregistration is complete
1 parent c1d286f commit e49973c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/core/Akka/IO/TcpConnection.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Linq;
1414
using System.Net.Sockets;
1515
using System.Runtime.CompilerServices;
16-
using System.Threading;
1716
using Akka.Actor;
1817
using Akka.Dispatch;
1918
using Akka.Event;
@@ -155,10 +154,7 @@ private Receive WaitingForRegistration(IActorRef commander)
155154
// up to this point we've been watching the commander,
156155
// but since registration is now complete we only need to watch the handler from here on
157156
if (!Equals(register.Handler, commander))
158-
{
159-
Context.Unwatch(commander);
160-
Context.Watch(register.Handler);
161-
}
157+
SignDeathPact(register.Handler); // will unsign death pact with commander automatically
162158

163159
if (_traceLogging) Log.Debug("[{0}] registered as connection handler", register.Handler);
164160

@@ -727,6 +723,7 @@ private void Abort()
727723
protected void StopWith(CloseInformation closeInfo)
728724
{
729725
_closedMessage = closeInfo;
726+
UnsignDeathPact();
730727
Context.Stop(Self);
731728
}
732729

0 commit comments

Comments
 (0)