comparison src/ch/ethz/ssh2/channel/ChannelManager.java @ 288:5824a1475be4 ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 19:59:32 -0700
parents 91a31873c42a
children d2ee20d9dff1
comparison
equal deleted inserted replaced
287:db9b028016de 288:5824a1475be4
44 private int nextLocalChannel = 100; 44 private int nextLocalChannel = 100;
45 private boolean shutdown = false; 45 private boolean shutdown = false;
46 private int globalSuccessCounter = 0; 46 private int globalSuccessCounter = 0;
47 private int globalFailedCounter = 0; 47 private int globalFailedCounter = 0;
48 48
49 private final Map<Integer, RemoteForwardingData> remoteForwardings = new HashMap<Integer, RemoteForwardingData>(); 49 private final HashMap<Integer, RemoteForwardingData> remoteForwardings = new HashMap<Integer, RemoteForwardingData>();
50
51 private AuthAgentCallback authAgent;
50 52
51 private final List<IChannelWorkerThread> listenerThreads = new ArrayList<IChannelWorkerThread>(); 53 private final List<IChannelWorkerThread> listenerThreads = new ArrayList<IChannelWorkerThread>();
52 54
53 private boolean listenerThreadsAllowed = true; 55 private boolean listenerThreadsAllowed = true;
54 56
456 /* Only now we are sure that no more forwarded connections will arrive */ 458 /* Only now we are sure that no more forwarded connections will arrive */
457 459
458 synchronized(remoteForwardings) { 460 synchronized(remoteForwardings) {
459 remoteForwardings.remove(bindPort); 461 remoteForwardings.remove(bindPort);
460 } 462 }
463 }
464
465 /**
466 * @param agent
467 * @throws IOException
468 */
469 public boolean requestChannelAgentForwarding(Channel c, AuthAgentCallback authAgent) throws IOException {
470 synchronized (this) {
471 if (this.authAgent != null)
472 throw new IllegalStateException("Auth agent already exists");
473
474 this.authAgent = authAgent;
475 }
476
477 synchronized (channels) {
478 globalSuccessCounter = globalFailedCounter = 0;
479 }
480
481 log.debug("Requesting agent forwarding");
482
483 PacketChannelAuthAgentReq aar = new PacketChannelAuthAgentReq(c.remoteID);
484 tm.sendMessage(aar.getPayload());
485
486 if (waitForChannelRequestResult(c) == false) {
487 authAgent = null;
488 return false;
489 }
490
491 return true;
461 } 492 }
462 493
463 public void registerThread(IChannelWorkerThread thr) throws IOException { 494 public void registerThread(IChannelWorkerThread thr) throws IOException {
464 synchronized(listenerThreads) { 495 synchronized(listenerThreads) {
465 if(listenerThreadsAllowed == false) { 496 if(listenerThreadsAllowed == false) {