cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: "100% CPU usage during SFTP transfer" bugfix

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 28 Aug 2009 23:52:44 +0200 (CEST)

On Fri, 28 Aug 2009, Kamil Dudka wrote:

>> - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL,
>> + result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL,
>> FIRSTSOCKET, NULL);
>
> This breaks SFTP upload completely:

I guess I need to stop blindly editing code and suggesting changes without
testing myself first....

The idea of mine is that both upload and download of SSH-based protocols need
both read and write sockets set since both directions will be needed.

>> -#if defined(USE_LIBSSH2)
>> - if(conn->protocol & (PROT_SCP|PROT_SFTP))
>> - select_res |= CURL_CSELECT_IN;
>> -#endif /* USE_LIBSSH2 */
>> } else
>> fd_read = CURL_SOCKET_BAD;
>
> This breaks SFTP *download*. Anyway it deserves a comment:
>
> 1) Why has been the exception here?

I don't remember, but I experience pain when I see it. It seems like a very
weird assumption and action. I would think our waitfor bits approach should be
a much better way to achieve something similar.

> 2) Why are you going to drop it right now?

Simply because that old #ifdef is related to the same problem we're working
on, and with a "proper" fix going on I think it is also motivated to get rid
of old dirty kludges.

-- 
  / daniel.haxx.se
Received on 2009-08-29