Question about integrating udns in Ruby EventMachine

Iñaki Baz Castillo ibc at aliax.net
Tue Feb 1 14:04:57 MSK 2011


2011/2/1 Michael Tokarev <mjt at tls.msk.ru>:
> File descriptor is just an integer.  And this is THE object which
> is used in udns to send and receive data AND to communicate with
> the rest of application -- application needs to call dns_ioevent()
> when the file descriptor in question is ready to be read.

Ok, understood.


>>> Also, don't forget about timeouts (timers).
>>
>> Ok. udns would call dns_timeouts() function.
>> At Ruby level EventMachine provides timers so I can realized that a
>> DNS query has not been completed in N seconds.
>
> It's exactly the other way around.  udns knows when next query
> will expire, your application calls provided function -- dns_timeouts() --
> to perform two tasks: 1) process expired queries, and 2) determine
> when next query will expire.  The second case is used in the
> main event loop to determine how much time we can sleep waiting
> for next event.
>
> Please read example source code, like ex-rdns.c, to see how it
> works.  So far I understand that you haven't looked at it at
> all - based on both cases above (filedescriptor and timeouts).

Yes, I've haven't read the full documentation neither the examples
yet. I'm sorry. For now I'm just wondering if building an async DNS
resolver for EventMachine is feasible by using udns. It seems it's
feasible so I'll go deeper into udns documentation and start coding
something.

Thanks a lot for your help.


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


More information about the udns mailing list