From 47d902611ca7617fbaa187c26846d378beae18a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 24 May 2012 23:23:58 +0200 Subject: Room implement new routing policy --- lib/iotas/room.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/iotas/room.rb b/lib/iotas/room.rb index 4482a6b..f3d0cfa 100644 --- a/lib/iotas/room.rb +++ b/lib/iotas/room.rb @@ -23,8 +23,7 @@ module Iotas # ERROR_ROUTE_NS = 'routing error: no source'.freeze ERROR_ROUTE_RRWD = 'routing error: right room, wrong door'.freeze - ERROR_ROUTE_DDWR = 'routing error: drill down, wrong room'.freeze - ERROR_ROUTE_TRWR = 'routing error: top room, wrong room'.freeze + ERROR_ROUTE_DNE = 'routing error: does not exists'.freeze ERROR_ROUTE_NDNL = 'routing error: no destination, no link'.freeze ERROR_ROUTE_SND = 'routing error: system no destination'.freeze # @@ -126,17 +125,10 @@ module Iotas else p.error! Iotas::ERROR_ROUTE_RRWD end - elsif (p.room=~/^#{path}\/(.*)/)==0 - room, *more = $1.split Iotas::PATH_SEP - if child=@iotas[room] - child.route_p p - else - p.error! Iotas::ERROR_ROUTE_DDWR - end - elsif @parent - @parent.route_p p + elsif door = @spin.search_world(p.room+Iotas::PATH_SEP+p.door) + p.dst_routed! door else - p.error! Iotas::ERROR_ROUTE_TRWR + p.error! Iotas::ERROR_ROUTE_DNE end end # -- cgit v1.1-2-g2b99