예제 #1
0
 internal static void delPort(Session session)
 {
     lock(pool)
     {
         PortWatcher[] foo=new PortWatcher[pool.size()];
         int count=0;
         for(int i=0; i<pool.size(); i++)
         {
             PortWatcher p=(PortWatcher)(pool.elementAt(i));
             if(p.session==session)
             {
                 p.delete();
                 foo[count++]=p;
             }
         }
         for(int i=0; i<count; i++)
         {
             PortWatcher p=foo[i];
             pool.removeElement(p);
         }
     }
 }
예제 #2
0
 internal static PortWatcher addPort(Session session, String address, int lport, String host, int rport, ServerSocketFactory ssf)
 {
     if(getPort(session, address, lport)!=null)
     {
         throw new JSchException("PortForwardingL: local port "+ address+":"+lport+" is already registered.");
     }
     PortWatcher pw=new PortWatcher(session, address, lport, host, rport, ssf);
     pool.addElement(pw);
     return pw;
 }