cURL / Mailing Lists / curl-library / Single Mail

curl-library

SFTP and curl_multi_socket problem

From: Luboš Doležel <lubos_at_dolezel.info>
Date: Tue, 24 Jun 2008 23:25:57 +0200

Hi,

I'm a developer of a download manager partially based on libcurl. It works
just great for HTTP, HTTPS and FTP, but it doesn't work when I use SFTP.

I've developed an epoll-based "engine" that adds/removes sockets to the epoll
when it receives a call (socket_callback) from CURL.

The epoll loop calls curl_multi_socket_action when an event is received or
curl_multi_socket_action with CURL_SOCKET_TIMEOUT when no event was received
during the timeout.

Now to the problem:
I add an easy SFTP download to the multi handle and when I call
curl_multi_socket_action(...CURL_SOCKET_TIMEOUT...), CURL calls
socket_callback with CURL_POLL_OUT (I return 0 = ok) and *immediately* -
during *the same* curl_multi_socket_action call - it tells me to remove the
very socket it has just told me to add.

Log:

CurlPoller::addTransfer 0x966c00
curl_multi_socket_action() - CURL_SOCKET_TIMEOUT
CURL debug: "About to connect() to localhost port 22 (#0)"
CURL debug: "Trying 127.0.0.1..."
CURL debug: "connected"
CURL debug: "Connected to localhost (127.0.0.1) port 22 (#0)"
CurlPoller::socket_callback - add/mod (CURL_POLL_OUT)
CurlPoller::socket_callback - remove
curl_multi_socket_action() - CURL_SOCKET_TIMEOUT
curl_multi_socket_action() - CURL_SOCKET_TIMEOUT

And that's all it does, it doesn't even send me a CURLMsg, nothing.
Interestingly, everything works fine when I use curl_multi_perform, but
that's obviously not what I want to do in an epoll cycle...

Do you have an idea what could be wrong?

-- 
Luboš Doležel
Received on 2008-06-24