Skip Menu |

This queue is for tickets about the Net-OpenSSH CPAN distribution.

Report information
The Basics
Id: 101476
Status: open
Priority: 0/
Queue: Net-OpenSSH

People
Owner: salva [...] cpan.org
Requestors: DEFCON [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: AnyEvent::OpenSSH
I see there is some async support available (async disconnect would be important to have too). How hard would it be to write an AnyEvent library/driver, perhaps called AnyEvent::OpenSSH which is similar to how AnyEvent::SNMP and others work? I took a look at some of the other AnyEvent libs and I have no idea where to begin to port this to be AnyEvent capable or else I'd try doing it myself :)
On Sun Jan 11 17:45:10 2015, DEFCON wrote: Show quoted text
> I see there is some async support available (async disconnect would be > important to have too). How hard would it be to write an AnyEvent > library/driver, perhaps called AnyEvent::OpenSSH which is similar to > how AnyEvent::SNMP and others work? I took a look at some of the > other AnyEvent libs and I have no idea where to begin to port this to > be AnyEvent capable or else I'd try doing it myself :)
The module already supports all the functionality required in order to build an AnyEvent layer on top of it (including async disconnection support). So, it shouldn't be too difficult to do so Actually it has been in my mind for a long time as I am also an AnyEvent fan, but unfortunately my spare time is scarce. In any case, you can just use it on AnyEvent without wrapping as follows: 1. Call the constructor with async => 1 2. Using a timer call $ssh->call_for_master repeatly every 0.1s until it succeeds (or you get an error back). 3. Use 'make_remote_command' to get a command you can pass back to AnyEvent::Util::run_cmd For disconnection, there is an undocumented 'disconnect' method accepting an async option. 1. Call $ssh->disconnect(1) 2. Repeatedly call wait_for_master until you get a defined but false value. And you are done. BTW, you should be using the latest development release as I have reworked the async disconnect support there and solved several bugs.