Subject: | Cannot catch a timeout with SSH2->tcpip() |
Distribution Net::SSH2-0.05
Perl: v5.8.0 built for i586-linux-thread-multi
OS: linux 2.4.20-4GB #1 Wed Aug 6 18:26:21 UTC 2003 i586
My process tries to keep a ssh2 connection established. I use a tcpip() channel to connect to a service on the remote side. To make sure all is well i want to catch a possible timeout when creating this connection:
eval
{
local $SIG{ALRM} = sub { die "timed out" };
alarm 3;
$CurSSH2Channel = $CurSSH2->tcpip('127.0.0.1', $port);
alarm 0;
};
if i DO NOT set a local $SIG{ALRM}, my process dies completly (that's not what i want). If I set a local handler, the process continues with the tcpip() call, seemingly ignoring SIGALRM.
Using a call like sleep(15) instead of SSH2->tcpip works fine.
I don't see another way to check if the SSH2 connection is still up.