lib/faye/adapters/rack_adapter.rb in faye-0.6.4 vs lib/faye/adapters/rack_adapter.rb in faye-0.6.5
- old
+ new
@@ -1,10 +1,10 @@
require 'json'
require 'rack'
require 'thin'
require 'cgi'
-require Faye::ROOT + '/thin_extensions'
+require Faye::ROOT + '/faye/thin_extensions'
module Faye
class RackAdapter
include Logging
@@ -43,10 +43,16 @@
@client ||= Client.new(@server)
end
def listen(port)
handler = Rack::Handler.get('thin')
- handler.run(self, :Port => port)
+ handler.run(self, :Port => port) { |s| @thin_server = s }
+ end
+
+ def stop
+ return unless @thin_server
+ @thin_server.stop
+ @thin_server = nil
end
def call(env)
Faye.ensure_reactor_running!
request = Rack::Request.new(env)