>
> Are you using the API in a blocking or non-blocking way?
>
> Non-blocking.

>
> If non-blocking: your code should already be prepared to handle EAGAIN and
> act accordingly when that happens => call libssh2_session_block_**directions()
> to see what to wait for, then wait and then call libssh2 again when things
> happen.
>
>
Well, it isn't exactly my code, as it is part of a library that is a wrapper
to libssh2:

qint64 QxtSshChannel::writeData(const char* buff, qint64 len){

    ssize_t ret=libssh2_channel_write_ex(d->d_channel,
d->d_write_stream_id,buff, len);

    if(ret<0){

        if(ret==LIBSSH2_ERROR_EAGAIN){

            return 0;

        }else{

#ifdef QXT_DEBUG_SSH

            qDebug()<<"write err"<<ret;

#endif

            return -1;

        }

    }

    if (len!=ret)

    {

        qDebug()<<QString("QxtSshChannel::writeData
******KRYTYCZNY!!!! do SSH zapisalo mniej niz dostalo!!!
(%1/%2)").arg(ret).arg(len);

    }

    return ret;

}


So instead of "return 0" I should call libssh2_session_block_directions()
and wait until either read or write to channel is available, depending on
block_directions result?
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to