Question about integrating udns in Ruby EventMachine

Iñaki Baz Castillo ibc at aliax.net
Tue Feb 1 13:20:54 MSK 2011


Hi, I just wonder if it's possible to integrate udns (as async DNS
resolver) into Ruby EventMachine (a reactor pattern library written in
C and C++ for Ruby).

EventMachine accepts any IO object so it performs non blocking read on
it and notify the Ruby code when it's readable. So I wonder if the
following could make sense:

- I code a Ruby C extension for udns. I need such C code to give me
the file descriptor in which udns listens for UDP responses from the
the DNS server.

- When such responses arrives the fd is readable so EventMachine would
call a Ruby "notify_readable()" method within the reactor.

- In that function I could invoke udns rutines for parsing the
response and, finally, get the DNS query result. I would translate
such result into Ruby code.


I don't know if this idea makes sense. Does it? For it, it would be
required that udns lets me to access its file descriptor instead of
udns directly managing it.

Thanks for any comment.

-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the udns mailing list