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

Re: Regarding setting timeout for ssh_sftp


On Wed, 2020-04-29 at 22:11 +0530, Yash Katta wrote:
> Hi,
> 
> My name is Yash. In my current project, I have used ssh_sftp
> APIs(sftp_open, sftp_write, sftp_close). When I interrupt my running
> process(communicating with server) with the following command in my
> Ubuntu
> 18.04.
> 
> sudo iptables -I INPUT -s 3.21.92.53 -j DROP
> 
> This blocks my complete process.
> 
> I just want to know how to set up ssh_sftp APIs, so that if the app
> doesn't
> get any response from the server. It will not block the my app. After
> a
> specified time period, It should return with some error and proceed
> further.
> 
> Other suggestions are also welcome.

Does it work if you set the session to non-blocking mode? Note, that at
this moment, you need to change the mode only after the sftp channel is
opened because of the bug [1].

But given the way how you "simulate" the timeout, it will also depend
on the OS configuraiton of TCP timeout.

[1] https://bugs.libssh.org/T220

Regards,
-- 
Jakub Jelen
Senior Software Engineer
Security Technologies
Red Hat, Inc.


Follow-Ups:
Re: Regarding setting timeout for ssh_sftpYash Katta <yash.katta1@xxxxxxxxx>
References:
Regarding setting timeout for ssh_sftpYash Katta <yash.katta1@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org