Example #1
0
        internal static void delPort(Session session, string address, int lport)
        {
            PortWatcher pw = getPort(session, address, lport);

            if (pw == null)
            {
                throw new JSchException("PortForwardingL: local port " + address + ":" + lport + " is not registered.");
            }
            pw.delete();
            pool.Remove(pw);
        }
Example #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.Add(pw);
            return(pw);
        }
Example #3
0
 internal static void delPort(Session session)
 {
     lock (pool)
     {
         PortWatcher[] foo   = new PortWatcher[pool.Count];
         int           count = 0;
         for (int i = 0; i < pool.Count; i++)
         {
             PortWatcher p = pool[i];
             if (p.session == session)
             {
                 p.delete();
                 foo[count++] = p;
             }
         }
         for (int i = 0; i < count; i++)
         {
             PortWatcher p = foo[i];
             pool.Remove(p);
         }
     }
 }
Example #4
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.Add(pw);
     return pw;
 }
Example #5
0
 internal static void delPort(Session session)
 {
     lock (pool)
     {
         PortWatcher[] foo = new PortWatcher[pool.Count];
         int count = 0;
         for (int i = 0; i < pool.Count; i++)
         {
             PortWatcher p = pool[i];
             if (p.session == session)
             {
                 p.delete();
                 foo[count++] = p;
             }
         }
         for (int i = 0; i < count; i++)
         {
             PortWatcher p = foo[i];
             pool.Remove(p);
         }
     }
 }