curl-and-python

Re: Help with curl_multi_socket interface

From: Nathan E. Moore <nate_at_redtetrahedron.org>
Date: Tue, 10 Jun 2008 19:22:22 -0400

Tried running it on linux:
Add socket 3
1 3 <pycurl.CurlMulti object at 0x81ce6ac> None
Add socket 4
1 4 <pycurl.CurlMulti object at 0x81ce6ac> None
Add socket 5
1 5 <pycurl.CurlMulti object at 0x81ce6ac> None
Timer callback msecs: 4816
Traceback (most recent call last):
  File "orignal_test_multi_socket_select.py", line 78, in <module>
    (rr, wr, er) = select.select(sockets,sockets,sockets,timeout/1000.0)
select.error: (9, 'Bad file descriptor')

A little more digging reveals that your socket call back is not always
getting called. This error happens when a socket is supposed to be removed,
but you never get notified. It appears get_thread_state_multi return NULL
resulting in a exit via silent error, in pycurl.c:multi_socket_callback.

Why have you reversed the order of the arguments to the socket callback?
The c level callback is (socket, event, userp, socketp) your python
callback takes (event, socket, multi, socketp)?

I can also confirm that the bizarre select loop isn't a problem. I
initially thought that was the issue but when I replaced pycurl with my
ctypes based binding it works.

Nathan.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2008-06-11