[Gajim-devel] blocking getaddrinfo

Damien Thébault damien.thebault at laposte.net
Sat Jun 28 03:58:10 CEST 2008


Le vendredi 27 juin 2008 à 11:45 +0200, Yann Leboulanger a écrit :
> Tomas Karasek wrote:
> > What I'm looking for is either
> >  - some elegant way how to do both A and AAAA requests asynchronously
> >    (like nonblocking getaddrinfo) which would be a nice solution
> > or
> >  - nonblocking detect that network is down which would allow to avoid
> >    needless call of getaddrinfo (temporary solution until some
> > suitable        library appears)
> > 
> > Do you have any ideas/suggestions on this?
> > 
> 
> Another solution is to create python bindings for libasyncns:
> http://0pointer.de/lennart/projects/libasyncns/

Hello everyone,

After reading Tomas Karasek's mail, I found libasyncns too.

This afternoon, I hacked a python binding while I was on a train (and
some hours after that), and I'm now able to use libasyncns from python.

Currently, it's not very clean (currently it's a first draft), it's
using swig (so we can see some "garbage" from python, like wrappers, but
it has some interesting features too).

Anyway, I'm able to do the same things than the "asyncns-test.c" file
from the libasyncns' documentation [1] (but in ~25 lines instead of
~125) (see the file asyncns-test.py).

I'm joining the code with this mail, if someone is interested. For
example, it may be used to test how gajim may work with libasyncns
someday (but I don't know what gajim needs).
(I didn't put licensing information already but it's LGPL2+, like the
libasyncns library)

Keep in mind that this is a work in progress, currently:
 - exceptions should work
 - IPv6 isn't available in getnameinfo
 - I don't store values from requests so I can't use a query object
   twice
 - some functions are not implemented:
      asyncns_getnext(), asyncns_getnqueries(), asyncns_getuserdata(),
      asyncns_setuserdata(), asyncns_res_search(), asyncns_fd()...
 - this is not deeply tested, and for example I don't know how memory is
   managed

[1]: http://0pointer.de/lennart/projects/libasyncns/doxygen/asyncns-test_8c-example.html

Regards,
-- 
Damien Thebault

Key C15AB8AF
Fingerprint 8FB9 8576 7033 4B45 3DF5  88E8 5471 1A44 C15A B8AF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libasyncns-python-1.tar.bz2
Type: application/x-bzip-compressed-tar
Size: 2564 bytes
Desc: not available
URL: <https://www.lagaule.org/pipermail/gajim-devel/attachments/20080628/0be9be10/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <https://www.lagaule.org/pipermail/gajim-devel/attachments/20080628/0be9be10/attachment.pgp>


More information about the Gajim-devel mailing list