Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix links the same as monitoring #27

Merged
merged 1 commit into from

2 participants

@rnewson

No description provided.

@moonpolysoft moonpolysoft merged commit a2e6dc5 into boundary:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2012
  1. @rnewson
This page is out of date. Refresh to see the latest.
View
28 src/main/scala/scalang/Node.scala
@@ -480,8 +480,11 @@ class ErlangNode(val name : Symbol, val cookie : String, config : NodeConfig) ex
}
if (isLocal(to)) {
- for (p <- process(to)) {
- p.registerLink(from)
+ process(to) match {
+ case Some(p : ProcessAdapter) =>
+ p.registerLink(from)
+ case None =>
+ break(link, 'noproc)
}
} else {
getOrConnectAndSend(to.node, LinkMessage(from, to), { channel =>
@@ -531,8 +534,13 @@ class ErlangNode(val name : Symbol, val cookie : String, config : NodeConfig) ex
if (!isLocal(from))
links.getOrElseUpdate(channel, new NonBlockingHashSet[Link]).add(link)
case None =>
- if (!isLocal(from))
+ if (isLocal(from)) {
+ log.warn("Try to link non-live process %s to %s", from, to)
+ val link = Link(from, to)
+ break(link, 'noproc)
+ } else {
links.getOrElseUpdate(channel, new NonBlockingHashSet[Link]).add(Link(from, to))
+ }
}
process(to) match {
@@ -542,8 +550,13 @@ class ErlangNode(val name : Symbol, val cookie : String, config : NodeConfig) ex
links.getOrElseUpdate(channel, new NonBlockingHashSet[Link]).add(link)
case None =>
- if (!isLocal(to))
+ if (isLocal(to)) {
+ log.warn("Try to link non-live process %s to %s", to, from)
+ val link = Link(from, to)
+ break(link, 'noproc)
+ } else {
links.getOrElseUpdate(channel, new NonBlockingHashSet[Link]).add(Link(from, to))
+ }
}
}
@@ -776,6 +789,13 @@ class ErlangNode(val name : Symbol, val cookie : String, config : NodeConfig) ex
} else {
getOrConnectAndSend(to.node, ExitMessage(from,to,reason))
}
+ if (isLocal(from)) {
+ for (proc <- process(from)) {
+ proc.handleExit(to, reason)
+ }
+ } else {
+ getOrConnectAndSend(from.node, ExitMessage(to,from,reason))
+ }
}
def process(pidOrProc : Any) : Option[ProcessAdapter] = pidOrProc match {
View
7 src/main/scala/scalang/node/ProcessAdapter.scala
@@ -143,7 +143,12 @@ trait ProcessAdapter extends ExitListenable with SendListenable with LinkListena
for (listener <- linkListeners) {
l.addLinkListener(listener)
}
- links.add(l)
+ synchronized {
+ if (state != 'alive)
+ l.break('noproc)
+ else
+ links.add(l)
+ }
l
}
Something went wrong with that request. Please try again.