Subject: Re: Callback for channel data ready

Re: Callback for channel data ready

From: Tom Weber <tom.weber_at_cryptzone.com>
Date: Thu, 15 Mar 2012 09:44:33 +0100

Daniel Stenberg skrev 3/14/12 11:12 PM:
>> So we would have to run a libssh2_channel_window_read_ex() loop after
>> each libssh2_channel_read_ex() loop, and repeat both loops until
>> libssh2_channel_window_read_ex() returns zero for all channels.
>
> I would do it simpler. I would just do this:
>
> select() on socket
>
> if(readable) {
>
> for(loop over all channels) {
>
> rc = libssh2_channel_read_ex( channel [check index] ...);
>
> ...
> }
> }
>

Sure, and that's what I did first, but I repeat my concern: What if
libssh2_channel_read_ex() reads data from the socket, which turns out to
be data for another channel which has already been checked? It will be
put aside in the queue and my app wouldn't learn of its existence before
the next select() returns, either because of a timeout or other SSH data.

-- 
Best Regards,
Tom Weber
Cryptzone Group AB
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-03-15