def serve(connection)
client = connection.client
$/ = "\000"
begin
timeout(@timeout.to_i) do
loop do
request = client.gets
if request =~ /policy-file-request/
client.puts(@xml)
debug("Sent xml data to client")
break
end
end
end
rescue Timeout::Error
bogusclient("connection timed out after #{@timeout} seconds", connection)
rescue Errno::ENOTCONN => e
warn("Unexpected disconnection while handling request")
rescue Errno::ECONNRESET => e
warn("Connection reset by peer")
rescue Exception => e
bogusclient("Unexpected #{e.class} exception: #{e}", connection)
end
end