Browse files

Moved Channel to the Server namespace

  • Loading branch information...
1 parent 5f46430 commit f920868ce459bb426fbd9748156144066b20ca32 @krakatoa krakatoa committed Feb 4, 2013
Showing with 13 additions and 5 deletions.
  1. +1 −1 lib/cucub-server.rb
  2. +4 −4 lib/dispatcher.rb
  3. +8 −0 lib/{ → server}/channel.rb
View
2 lib/cucub-server.rb
@@ -1,5 +1,5 @@
require 'cucub-protocol'
-require_relative './channel'
+require_relative './server/channel'
require_relative './dispatcher'
require_relative './server'
View
8 lib/dispatcher.rb
@@ -33,7 +33,7 @@ def start(block=nil)
@ipc_get = Cucub::Channel.ipc_get
=end
if Cucub::Server::Configuration.instance.uses.include? ("box")
- @box = Cucub::Channel.reply
+ @box = Cucub::Server::Channel.reply
end
####
@@ -72,13 +72,13 @@ def start(block=nil)
end
def init_inner_channels
- @inner_inbound = Cucub::Channel.inner_inbound
- @inner_outbound = Cucub::Channel.inner_outbound
+ @inner_inbound = Cucub::Server::Channel.inner_inbound
+ @inner_outbound = Cucub::Server::Channel.inner_outbound
end
def stop
#### Cucub::LiveProxy.shutdown!
- Cucub::Channel.shutdown!
+ Cucub::Server::Channel.shutdown!
#EM.stop
end
end
View
8 lib/channel.rb → lib/server/channel.rb
@@ -1,4 +1,5 @@
module Cucub
+ class Server
module Channel
=begin
def self.initialize
@@ -24,6 +25,9 @@ def self.reply
# Usar EM Defer
#Cucub::LiveObject.pass(msg)
+ message = Cucub::Message.parse(msg)
+ # TODO Route messages according class_name and object_uuid
+
@inner_inbound.send_string(msg)
@reply.send_string("Cucub::Reply ok!")
@@ -74,6 +78,9 @@ def self.inner_outbound
@inner_outbound = PanZMQ::Pull.new
@inner_outbound.bind "ipc:///tmp/cucub-inner-outbound.sock"
@inner_outbound.register
+ @inner_outbound.on_receive {|msg|
+ puts "Received at Inner Outbound: #{msg}"
+ }
end
####
@@ -159,4 +166,5 @@ def self.shutdown!
PanZMQ.terminate
end
end
+ end
end

0 comments on commit f920868

Please sign in to comment.