module Celluloid
  module DNS
    class Server
      # Maximum UDP packet we'll accept
      MAX_PACKET_SIZE = 512
      
      include Celluloid::IO
      
      def initialize(addr, port, &block)
        @block = block
        
        # Create a non-blocking Celluloid::IO::UDPSocket
        @socket = UDPSocket.new
        @socket.bind(addr, port)
        
        async.run
      end
      
      def run
        loop do
          data, (_, port, addr) = @socket.recvfrom(MAX_PACKET_SIZE)
          @block.call Request.new(addr, port, @socket, data)
        end
      end
    end
  end
end
module Celluloid
  module DNS
    class Server
      # Maximum UDP packet we'll accept
      MAX_PACKET_SIZE = 512
      
      include Celluloid::IO
      
      execute_block_on_receiver :initialize
      
      def initialize(addr, port, &block)
        @block = block
        
        # Create a non-blocking Celluloid::IO::UDPSocket
        @socket = UDPSocket.new
        @socket.bind(addr, port)
        
        async.run
      end
      
      def run
        loop do
          data, (_, port, addr) = @socket.recvfrom(MAX_PACKET_SIZE)
          @block.call Request.new(addr, port, @socket, data)
        end
      end
    end
  end
end

Fix calling the callback block
Fix calling the callback block

execute_block_on_receiver was all that was missing to make it work ^^ @tarcieri