Subject: Re: [libssh2] code hangs with sftp downloads, solved

Re: [libssh2] code hangs with sftp downloads, solved

From: E L <crc1021_at_gmail.com>
Date: Fri, 12 Sep 2008 14:38:29 -0500

On Fri, Sep 12, 2008 at 2:22 PM, Yang Tse <yangsita_at_gmail.com> wrote:
> 2008/9/12, E L <crc1021_at_gmail.com> wrote:If the connection
>> gets reset, the call to send() or recv() will fail, but there is a
>> good chance errno will still be set to EAGAIN, so the code will keep
>> trying indefinititely.
>
> Yes the real problem is that errno is not being cleared for WIN32 if
> the call to recv() or send() succeeds!
>
>> patch is included below to set errno for all send() and recv()
>
> Your patch was real close, but it doesn't address the above statement.
>
> Could you verify if the attached patch works fine for you, and report
> back to the list, so that someone might commit it to CVS ?

Right now, the code works because errno is only checked if the result
of the socket call fail, so clearing it before the call is not needed.
 The bigger issue is that on Windows, send() and recv() do not set
errno at all.
http://msdn.microsoft.com/en-us/library/ms737828(VS.85).aspx

I'm running the patched version right now and it is working.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2008-09-12