lib/camtasy/server.rb in camtasy-0.0.1 vs lib/camtasy/server.rb in camtasy-0.0.2

- old
+ new

@@ -1,9 +1,7 @@ module Camtasy class PhotoServer - attr_reader :request, :response - def initialize @request = Queue.new @response = Queue.new @mutex = Mutex.new end @@ -13,21 +11,19 @@ @request << "x" @response.pop end end - def run + def run(uri) Thread.new do AVCapture::Session.new.run_with(AVCapture.devices.find(&:video?)) do |connection| - while server.request.pop - server.response.push(connection.capture) + while @request.pop + @response.push(connection.capture) end end end - DRb.start_service('druby://localhost:8787', server) + DRb.start_service(uri, self) DRb.thread.join end end end - -PhotoServer.new.run