summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/room.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 10:10:02 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 10:10:02 +0200
commite8fde9995210e8d7ab64c19ec7d5fc9ca3a647eb (patch)
treea4684b3e24e9b74fe526e3c217a487d0822274b0 /lib/evendoors/room.rb
parent926d94249ce40216f98c6e0c66b22fbf88582821 (diff)
downloadedoors-ruby-e8fde9995210e8d7ab64c19ec7d5fc9ca3a647eb.zip
edoors-ruby-e8fde9995210e8d7ab64c19ec7d5fc9ca3a647eb.tar.gz
Room: detect missing door or src
Diffstat (limited to 'lib/evendoors/room.rb')
-rw-r--r--lib/evendoors/room.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb
index 6e464d2..99e9139 100644
--- a/lib/evendoors/room.rb
+++ b/lib/evendoors/room.rb
@@ -75,9 +75,7 @@ module EvenDoors
end
#
def route_p p
- if p.door.empty?
- p.error! EvenDoors::ERROR_ROUTE_NDN
- elsif p.room.nil? or p.room==path
+ if p.room.nil? or p.room==path
if door = @spots[p.door]
p.dst_routed! door
else
@@ -97,7 +95,14 @@ module EvenDoors
puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug
if p.next_dst
p.split_dst!
- route_p p
+ 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
+ end
elsif p.src.nil?
p.error! EvenDoors::ERROR_ROUTE_NDNS, space
elsif not try_links p