Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove entry from registeredNames on exit

  • Loading branch information...
commit a5ccbbee7afcfa378ddce936e2e773b5ba3e0c03 1 parent 07e1a69
@rnewson authored
View
6 src/main/scala/scalang/Node.scala
@@ -631,6 +631,12 @@ class ErlangNode(val name : Symbol, val cookie : String, config : NodeConfig) ex
Unit
}
processes.remove(from)
+ registeredNames find { e => e._2 == from } match {
+ case Some(entry) =>
+ registeredNames.remove(entry._1)
+ case None =>
+ return
+ }
}
//this only gets called from a remote link breakage()
View
12 src/test/scala/scalang/NodeSpec.scala
@@ -101,6 +101,18 @@ class NodeSpec extends SpecificationWithJUnit {
Thread.sleep(100)
Option(node.processes.get(pid)) must beNone
}
+
+ "unregister processes on exit" in {
+ node = Node(Symbol("scala@localhost"), cookie)
+ val pid = node.spawn[FailProcess]
+ node.register('foo, pid)
+ node.processes.get(pid) must beLike { case f : Process => true }
+ node.whereis('foo) must ==(Option(pid))
+ node.handleSend(pid, 'bah)
+ Thread.sleep(100)
+ Option(node.processes.get(pid)) must beNone
+ node.whereis('foo) must beNone
+ }
"deliver local breakages" in {
node = Node(Symbol("scala@localhost"), cookie)
Please sign in to comment.
Something went wrong with that request. Please try again.