timer for a function
mk
mrkafk at gmail.com
Fri Feb 5 12:23:09 EST 2010
I have the following situation:
1.
self.conobj = paramiko.SSHClient()
self.conobj.connect(self.ip, username=self.username,
key_filename=self.sshprivkey, port=self.port, timeout=opts.timeout)
2. very slow SSH host that is hanging for 30+ seconds on key exchange.
The timeout in the options regards only a socket timeout, not further
stages of connection negotiation, so it doesn't work there.
On paramiko mailing list I got the suggestion to build a timer and then
quit this by myself:
> The timeout option in connect() is for the socket, not for the entire
> operation. You are connected, so that timeout is no longer relevant.
> You would probably have to wrap the transport.connect() method in a
> timer to break out of this early.
Question: how can I do that? Use another threaded class? Is there some
other way?
Additional snag is SSHClient() is a class that internally uses threads.
How do I kill brutally its threads? Is there any way to do it?
Regards,
mk
More information about the Python-list
mailing list