[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using ssh_bind_set_callbacks


Hi,

Excellent idea. You don't need to set it non blocking. Also check for
POLLOUT|POLLIN instead. POLLIN will trigger on linux but some OS (I
think some BSD and windows) use POLLOUT for new connections.

Aris

Le 16/07/15 08:22, Игорь Коваленко a écrit :
> I've coped with the problem a following way:
> - create new bind;
> - call ssh_bind_listen
> - make it unblocking with ssh_bind_set_blocking(...,0) (though maybe
> it's unnecessary, I didn't check it)
> - create new event
> - add to the event a socket from bind -
> ssh_event_add_fd(ssh_bind_get_fd(m_bind), POLLIN,
> incomingConnectionCallback)
> - start a new event poll loop
> - in callback funcion int incomingConnection(socket_t fd, int revents,
> void *userdata)
> * create new session
> * accept it with ssh_bind_accept
>
>
> 2015-07-16 0:20 GMT+03:00 Aris Adamantiadis <aris@xxxxxxxxxxxx
> <mailto:aris@xxxxxxxxxxxx>>:
>
>     It is totally possible that the library misses some glue to integrate
>     ssh_binds in the event model. The last users who needed something
>     similar used a forked or a threading model.
>     I also think some callbacks are defined but not really implemented.
>
>     I will have a look asap, that requires a fix.
>
>     Aris
>
>     Le 15/07/15 23:13, Andreas Schneider a écrit :
>     > On Wednesday 15 July 2015 16:25:36 Phil Lello wrote:
>     >> Hi all,
>     >>
>     >> I'm currently developing my first server with libssh, but am a
>     little
>     >> uncertain as the the use of ssh_bind_set_callbacks - there
>     doesn't seem to
>     >> be a call to add the bind to ssh_event....
>     > That's a really good questions. It looks like the API is not
>     complete.
>     >
>     > We have a ssh_bind_get_poll() function isn't called by anything
>     so the
>     > callback can't be triggered at all. Go with this example ...
>     >
>     >
>     https://git.libssh.org/projects/libssh.git/tree/examples/ssh_server_fork.c
>     >
>
>
>


References:
Using ssh_bind_set_callbacksPhil Lello <phil@xxxxxxxxxxxxxxx>
Re: Using ssh_bind_set_callbacksAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: Using ssh_bind_set_callbacksAris Adamantiadis <aris@xxxxxxxxxxxx>
Re: Using ssh_bind_set_callbacksИгорь Коваленко <igor.a.kovalenko@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org