def initialize(server, dnsbackend)
@dnsbackend = dnsbackend
@semaphore = Mutex.new
- @f = File.open("/tmp/remotebackend.txt.#{$$}","a")
- @f.sync
+ unless defined? @@f
+ @@f = File.open("/tmp/remotebackend.txt.#{$$}","a")
+ @@f.sync
+ end
+ @dnsbackend.do_initialize({})
end
def parse_arrays(params)
args = parse_arrays args
- @f.puts "#{Time.now.to_f} [http]: #{({:method=>method,:parameters=>args}).to_json}"
+ @@f.puts "#{Time.now.to_f} [http]: #{({:method=>method,:parameters=>args}).to_json}"
@semaphore.synchronize do
if @dnsbackend.respond_to?(method.to_sym)
res["Content-Type"] = "application/javascript; charset=utf-8"
res.body = ({:result => false, :log => ["Method not found"]}).to_json
end
- @f.puts "#{Time.now.to_f} [http]: #{res.body}"
+ @@f.puts "#{Time.now.to_f} [http]: #{res.body}"
end
end