Пример #1
0
 /// <exception cref="NSch.JSchException"></exception>
 internal static void DelPort(Session session, string address, int lport)
 {
     NSch.PortWatcher pw = GetPort(session, address, lport);
     if (pw == null)
     {
         throw new JSchException("PortForwardingL: local port " + address + ":" + lport +
                                 " is not registered.");
     }
     pw.Delete();
     pool.RemoveElement(pw);
 }
Пример #2
0
 internal static void DelPort(Session session)
 {
     lock (pool)
     {
         NSch.PortWatcher[] foo = new NSch.PortWatcher[pool.Count];
         int count = 0;
         for (int i = 0; i < pool.Count; i++)
         {
             NSch.PortWatcher p = (NSch.PortWatcher)(pool[i]);
             if (p.session == session)
             {
                 p.Delete();
                 foo[count++] = p;
             }
         }
         for (int i_1 = 0; i_1 < count; i_1++)
         {
             NSch.PortWatcher p = foo[i_1];
             pool.RemoveElement(p);
         }
     }
 }