diff --git a/remote/endpoint_manager.go b/remote/endpoint_manager.go index cde748a85..2fe77335f 100644 --- a/remote/endpoint_manager.go +++ b/remote/endpoint_manager.go @@ -127,8 +127,7 @@ func (em *endpointManagerValue) removeEndpoint(msg *EndpointTerminatedEvent) { em.connections.Delete(msg.Address) ep := le.valueFunc() ep.watcher.Tell(msg) - ep.watcher.Stop() - ep.writer.Stop() + ep.writer.Tell(msg) } } } diff --git a/remote/endpoint_watcher.go b/remote/endpoint_watcher.go index 4c87ec422..f3efcfe48 100644 --- a/remote/endpoint_watcher.go +++ b/remote/endpoint_watcher.go @@ -71,6 +71,7 @@ func (state *endpointWatcher) Receive(ctx actor.Context) { //Clear watcher's map state.watched = make(map[string]*actor.PIDSet) ctx.SetBehavior(state.Terminated) + ctx.Self().Stop() case *remoteWatch: //add watchee to watcher's map diff --git a/remote/endpoint_writer.go b/remote/endpoint_writer.go index b589609b9..1cd9e6763 100644 --- a/remote/endpoint_writer.go +++ b/remote/endpoint_writer.go @@ -155,6 +155,8 @@ func (state *endpointWriter) Receive(ctx actor.Context) { state.conn.Close() case *actor.Restarting: state.conn.Close() + case *EndpointTerminatedEvent: + ctx.Self().Stop() case []interface{}: state.sendEnvelopes(msg, ctx) case actor.SystemMessage, actor.AutoReceiveMessage: