Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ................... Crashes ......................
- - (void)startSSH:(id)nothing;
- {
- NSAutoreleasePool * pool = [NSAutoreleasePool new];
- mTunnel = [[SSHTunnelManager sharedInstance] tunnelWithSSHHost:[sshHost stringValue] sshUser:[sshUser stringValue] sshPassword:[sshPassword stringValue]
- localPort:[localPort intValue] remotePort:[remotePort intValue]];
- @synchronized(self) {
- if (![mTunnel isConnected]) {
- NSString * error = nil;
- if (![mTunnel start:&error]) {
- //NSRunAlertPanel(@"SHH tunnel could not connect.", error, @"OK", nil, nil);
- NSLog(@"SHH tunnel could not connect. %@", error);
- mTunnel = nil;
- } else {
- NSLog(@"SHH tunnel is connected.");
- }
- }
- }
- NSLog(@"releasing pool from thread %@", [NSThread currentThread]);
- [pool release];
- }
- // ................... Works ......................
- - (void)startSSH:(id)nothing;
- {
- NSAutoreleasePool * pool = [NSAutoreleasePool new];
- @synchronized(self) {
- mTunnel = [[SSHTunnelManager sharedInstance] tunnelWithSSHHost:[sshHost stringValue] sshUser:[sshUser stringValue] sshPassword:[sshPassword stringValue]
- localPort:[localPort intValue] remotePort:[remotePort intValue]];
- if (![mTunnel isConnected]) {
- NSString * error = nil;
- if (![mTunnel start:&error]) {
- //NSRunAlertPanel(@"SHH tunnel could not connect.", error, @"OK", nil, nil);
- NSLog(@"SHH tunnel could not connect. %@", error);
- mTunnel = nil;
- } else {
- NSLog(@"SHH tunnel is connected.");
- }
- }
- }
- NSLog(@"releasing pool from thread %@", [NSThread currentThread]);
- [pool release];
- }
- - (SSHTunnel *)tunnelWithSSHHost:(NSString *)sshHost sshUser:(NSString *)sshUser sshPassword:(NSString *)sshPassword
- localPort:(uint16_t)localPort remotePort:(uint16_t)remotePort;
- {
- SSHTunnel * tunnel = nil;
- @synchronized(self) {
- if ([mSSHTunnels count] > 0) {
- tunnel = [mSSHTunnels objectAtIndex:0];
- }
- if (!tunnel) {
- NSLog(@"Creating tunnel on thread %@", [NSThread currentThread]);
- tunnel = [[SSHTunnel alloc] initWithSSHHost:sshHost sshUser:sshUser sshPassword:sshPassword localPort:localPort remotePort:remotePort];
- [mSSHTunnels addObject:tunnel];
- [tunnel autorelease];
- }
- }
- return tunnel;
- }
Add Comment
Please, Sign In to add comment