The sub works fine if I call it before I startup and threads. If I call it in a thread I get the following error:sub sftp_file { my ($file,$destfile,$host,$port,$user,$privpath,$pubpath,$pass) = +@_; my $ssh2 = Net::SSH2->new(); $ssh2->connect( $host,$port ) or $logger->info("Connect failed: $! +\n"); if ( !$ssh2->error ) { $ssh2->auth( username => $user, publickey => $pubpath, private +key => $privpath, password => $pass, passphrase => undef ) or $logger +->info("Authent ication failed: $!\n"); } if ( $ssh2->auth_ok ) { my $sftp = Net::SFTP::Foreign->new( ssh2 => $ssh2, backend => +'Net_SSH2' ); $sftp->error and $logger->info("Unable to establish SFTP conne +ction: $sftp->error\n"); $sftp->put( "$file", "$destfile", best_effort => 1 ) or ( $log +ger->info("Put failed: $sftp->error\n") && return ); return 1; } else { return 0; } }
When I turn on tracing of libssh2 and debug I see the followingConnect failed: Resource temporarily unavailable
Is there work around ?[libssh2] 0.822042 Transport: session_startup for socket 5 [libssh2] 0.822225 Transport: Sending Banner: SSH-2.0-libssh2_1.8.0 [libssh2] 0.822280 Socket: Sent 23/23 bytes at fe7b1570+0 [libssh2] 0.822334 Socket: Recved 0 bytes banner [libssh2] 0.822366 Failure Event: -13 - Failed getting banner Net::SSH2::DESTROY object 0x3413458 [libssh2] 0.825767 Transport: Freeing session resource [libssh2] 0.825807 Transport: Extra packets left 0 [libssh2] 0.825839 Transport: unable to reset socket's blocking state
In reply to Net::SSH2 issue in thread by roperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |