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

Re: Working on keepalive messages while waiting for local connection


On Wednesday, 11 April 2018 16:27:16 CEST g4-lisz@xxxxxxxxxxxx wrote:
> Hello all
> 
> I realized that SSH servers with the keep-alive option enabled first
> send the keep-alive _global_ request as long as nothing had connected to
> the local TCP socket:
> 
> $> ssh -v -N xxx@yyy -L 8088:testcom.com:80
> 
>     debug1: client_input_global_request: rtype keepalive@xxxxxxxxxxx
> want_reply 1
> 
> After connecting to localhost:8088, these requests are sent over the
> channel:
> 
>     debug1: client_input_channel_req: channel 2 rtype
> keepalive@xxxxxxxxxxx reply 1
> 
> From this I conclude that the channel should not be opened before there
> is a waiting connection on the local TCP socket.
> But how do I tell libssh to work on the global request as long as there
> is no open channel?
> 
> Maybe I have to use ssh_get_fd() and the use select() also on this
> socket while waiting for the local incoming connections? And then use
> ssh_set_fd_toread()?
> 
> I would appreciate a lot if someone could show me some sample code.

I think that ssh_event_dopoll() will handle it and call the appropriate 
callback. Don't use ssh_select()

In master we have the new connector API which is easier to use, see
https://git.libssh.org/projects/libssh.git/tree/examples/ssh_client.c

-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx



Archive administrator: postmaster@lists.cynapses.org