Damien Thébault a écrit :
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,

Wow cool ! We unfortunatly don't have much time now because we'd like to release very very soon, but that would be very cool to finalize that. What are you plans about those bindings? Do you think to send them to author so that he can release them? Do you think to start new project to them?

But for sure it's interesting as it's the only async python module that allows AAAA resolution.

--
Yann
_______________________________________________
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel

Reply via email to