An update on my previous post:

I've tried calling libssh2_sftp_read with an ever increasing buffer
until it fails:

        for (unsigned long i = 32000; i < 6000000; i+=100)
        {
                cout << "trying buffer size " << i << endl;

                char *buf = new char[i];
                ssize_t cbRead = libssh2_sftp_read(handle, buf, i);
                delete [] buf;

                if (cbRead < 0)
                {
                        cerr << "libssh2_sftp_read() failed" << endl;
                        exit(1);
                }
        }

and found some strange results.

If I increment the buffer size (i) by large amounts (>= 167), the
first failure is when trying a size of 39992. However!  If I use a
smaller increment (< 167) the read succeeds well past 39992.  I'm not
sure how far it goes (I gave up trying after a while) but far enough.

What I did notice was that the output appears line-after-line maybe at
a rate of 3 lines per second and on a failing (large increment) run
this is as far as it gets.  On a successful (small increment) run it
does the same for the first few (30-40 ?) attempts, but then suddenly
speeds up to more than 100 lines a second and zooms past the spot
where I expect a failure.

If I move the start of the run from 32000 to something else, the
threshold of 167 changes so it seems that, in order to get a
successful run, it needs enough of a 'run-up' before the 39992 mark to
get into 'fast-mode'

Madness.

Does anyone have any ideas what might be happening?  I'm afraid I
haven't got a clue where to start debugging this.

Many thanks.

Alex

P.S. The only vaguely remarkable thing about the number 39992 is that
the number after it (39993) is symmetrical in binary and decimal:
1001110000111001.  As you can see, I'm grasping at straws :P

-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to