summaryrefslogtreecommitdiffstats
path: root/lib/evendoors
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 10:25:10 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 10:25:10 +0200
commit2dc20ea5c1bf72e996e99d60b42d4e71d04d2462 (patch)
tree962f39d2a4a95902129e4f2cff32166b236ae4d3 /lib/evendoors
parent8a600d5815fb2a44fd9d993c85b43edb7ea1dc8c (diff)
downloadedoors-ruby-2dc20ea5c1bf72e996e99d60b42d4e71d04d2462.zip
edoors-ruby-2dc20ea5c1bf72e996e99d60b42d4e71d04d2462.tar.gz
Room: do not route orphan particles, doorless particles get the boomerang effect
Diffstat (limited to 'lib/evendoors')
-rw-r--r--lib/evendoors/room.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb
index 99e9139..358d53c 100644
--- a/lib/evendoors/room.rb
+++ b/lib/evendoors/room.rb
@@ -93,18 +93,17 @@ module EvenDoors
#
def send_p p
puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug
- if p.next_dst
+ if p.src.nil?
+ # do not route orphan particles !!
+ p.error! EvenDoors::ERROR_ROUTE_NS, space
+ elsif p.next_dst
p.split_dst!
if p.door
- p.src = space if p.src.nil? # send error to space if needed
route_p p
- elsif p.src
- p.dst_routed! p.src
else
- p.error! EvenDoors::ERROR_ROUTE_NDNS, space
+ # boomerang
+ p.dst_routed! p.src
end
- elsif p.src.nil?
- p.error! EvenDoors::ERROR_ROUTE_NDNS, space
elsif not try_links p
p.error! EvenDoors::ERROR_ROUTE_NDNL
end