Subject: Re: [libssh2] Wrap up a release!

Re: [libssh2] Wrap up a release!

From: E L <crc1021_at_gmail.com>
Date: Tue, 17 Mar 2009 13:49:21 -0500

>
>> Socket errors are not properly handled for win32.  If the call to recv() or
>> send() fails, then WSAGetLastError() needs to be called to get the error.
>> In two spots this is mostly done: session.c:116 and transport.c:370.
>> However, not all errors are covered in the switch and there is no default to
>> catch the miscellaneous errors.
>
> Uh, did that discussion ever result in anything? I was confused then and
> re-reading it still confuses me.
>
> For clarification, can you please post your suggested patch (again) ?
>
> I've also modified code that I believe makes it necessary to resync the patch
> anyway.

Nothing happened, I've been keeping local modifications to the library.

The past thread got sidetracked, so forgot about it. Is the bug
clear? libssh2 uses errno, but win32 recv() and send() do not set
errno, so libssh2 code needs to set errno based on WSAGetLastError()
after calling send() or recv().

The current libssh2 code does this in two spots after recv():
#ifdef WIN32
            switch (WSAGetLastError()) {
                case WSAEWOULDBLOCK:
                    errno = EAGAIN;
...
#endif

My patch just builds off the existing code. It does 3 things
1. adds a default to the switch to ensure all errors are trapped
2. adds that code to the error routines after send() calls
3. consolidated the replicated code into one function so the exact
same switch statement is not in 5 locations

I can generate another patch, but it will probably be seen as "not clean" again.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-03-17