www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: Multiple channels and epoll(7)

Re: Multiple channels and epoll(7)

From: Eduardo Silva <edsiper_at_gmail.com>
Date: Wed, 25 Jun 2014 21:54:55 -0600

On Wed, Jun 25, 2014 at 3:15 AM, Henrik Nordström
<henrik_at_henriknordstrom.net> wrote:
> tis 2014-06-24 klockan 22:28 -0600 skrev Eduardo Silva:
>> hmm so if my socket is in an event loop and i get notifications,
>> besides to walk through my list of active channels, for each one
>> should i also walk for each stream_id ?, if so, how can i know the
>> number of streams that a channel is handling ?
> By the application you are running.
> port forwarding -> only the default stream.
> shell -> default stream + stream 1 (stderr).
> Should be safe to assume the server do not unexpectedly start using
> stream numbers you don't know about.

thanks for the feedback.

Just to confirm if my approach is correct:

1. i connect to the SSH server and request a tcp-forwarding
2. then in my program i have an epoll(7) loop looking for EPOLLIN (READ) events:
3. for each incoming event i do:
   3.a try to accept a channel, if it works create the channel and add
it to a list (and jump to 3.c)
   3.b if accept a channel failed, try to read for each channel
registered in my list
   3.c for those channels who succeeded on reading data, write back a
response, then close the channel (channel cleanup)

but for some reason i see some missing channels notifications when
adding a simple concurrency of 2 clients. Should i use a different
mechanism to multiplex events on different channels ?, is there
something wrong with the proposed model ?

any help is appreciated

Eduardo Silva
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2014-06-26

the libssh2 team