lib/miu/proxy.rb in miu-0.2.0 vs lib/miu/proxy.rb in miu-0.2.1
- old
+ new
@@ -1,18 +1,18 @@
-require 'miu/socket'
+require 'miu/sockets'
require 'ffi-rzmq'
module Miu
class Proxy
attr_reader :frontends, :backends
attr_reader :poller
PROXY_TO = '@__proxy_to__'
def initialize(frontends, backends)
- @frontends = Array(frontends).map { |s| unwrap s }
- @backends = Array(backends).map { |s| unwrap s }
+ @frontends = Array(frontends).map { |s| s.to_io rescue s }
+ @backends = Array(backends).map { |s| s.to_io rescue s }
@frontends.each { |s| s.instance_variable_set PROXY_TO, @backends }
@backends.each { |s| s.instance_variable_set PROXY_TO, @frontends }
@poller = ::ZMQ::Poller.new
@@ -38,20 +38,9 @@
msg.close
break unless more
end
end
- end
- end
-
- private
-
- def unwrap(socket)
- case socket
- when Miu::Socket
- socket.socket
- else
- socket
end
end
end
end