Subject: Re: Callback for channel data ready

Re: Callback for channel data ready

From: Peter Stuge <>
Date: Fri, 2 Mar 2012 20:01:36 +0100

Mitchell Hashimoto wrote:
> I'd like to stay away from callbacks now. It complicates many details.

It's not so bad, libssh2 is not thread safe anyway, so there would
not be many problems.

> If libssh2 were to return a list of ready channels, would it buffer these
> all somewhere? Does libssh2 already do this internally (which would make
> this easy)?

It does already. If you're in blocking mode and call _channel_read()
on one channel, but a packet for another channel comes in, libssh2
has to deal.

I'm with Daniel about supporting multiple channels. Taking it a
little bit further I think it might not be a bad idea to model the
API after select() and poll(), meaning that the caller provides a
list of currently interesting channels, and libssh2 returns saying
what action there is to take.

Received on 2012-03-02