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 10:45:15 +0100

Peter Stuge skrev 3/15/12 10:13 AM:
> Tom Weber wrote:
>> 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?
>
> Keep looping over all channels until none return data.
>

The same thing can happen there. Even if no libssh2_channel_read_ex()
call returns data during a loop, one of them can read data from the
socket, for a channel which has already been checked. What I need is a
way to check for data *without* reading more from the socket.

I would probably have designed the API so that the app explicitly reads
socket data with libssh2_transport_read(), wrapped in
libssh2_session_read(), and libssh2_channel_read() would only operate on
that data, it wouldn't call libssh2_transport_read() itself. But I guess
it's too late to make such a change.

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