Subject: Re: SFTP issues

Re: SFTP issues

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 7 Feb 2012 17:42:54 +0100

Peter Stuge wrote:
> > >>      while(chunk) {
> ..
> > >>              rc = _libssh2_channel_write(channel, 0,
> > >>                                          &chunk->packet[chunk->sent],
> > >>                                          chunk->lefttosend);
> ..
> > > It doesn't seem like there is any point in having this loop anymore,
> > > since libssh2 must return after every call to _channel_write() in any
> > > case.
> >
> > Not every call, right? Only when it returns an error.
>
> Yes, every call, because if there was data received successfully it
> must be given back to the caller before trying to write to the
> channel again, since writing can cause EAGAIN.

That sounded backwards, but the point holds, the call must return for
every successful transfer since the next transfer can always result
in EAGAIN and libssh2 can return only "some data transfered" or
EAGAIN.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-02-07