Sha256: 8b2b15487659045f126f844e31491a84c0fd3d7e5a582e813541c261b4f3d09e
Contents?: true
Size: 594 Bytes
Versions: 1
Compression:
Stored size: 594 Bytes
Contents
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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
celluloid-dns-0.0.1 | lib/celluloid/dns/server.rb |