# File flashpolicyd.rb, line 254
  def serve(connection)
    client = connection.client
        
    # Flash clients send a null terminate request
    $/ = "\000"

    # run this in a timeout block, clients will have --timeout seconds to complete the transaction or go away
    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