Daniel Stenberg wrote:
> @@ -1218,16 +1218,17 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * 
> handle, char *buffer,
>  
>      while(chunk) {
>          if(chunk->lefttosend) {
> +            if(total_read)
> +                /* since we risk getting EAGAIN below, we return here if 
> there
> +                   is data available */
> +                return total_read;
> +
>              rc = _libssh2_channel_write(channel, 0,
>                                          &chunk->packet[chunk->sent],
>                                          chunk->lefttosend);
>              if(rc < 0) {
> -                if(rc != LIBSSH2_ERROR_EAGAIN)
> -                    /* error */
> -                    return rc;
> -                eagain++;
>                  sftp->read_state = libssh2_NB_state_sent;
> -                break;
> +                return rc;
>              }

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.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to