예제 #1
0
 public override void Dispose()
 {
     if (disposed)
     {
         return;
     }
     disposed = true;
     if (IsConnected && ConnectionClosed != null)
     {
         ConnectionClosed();
     }
     lock (q)
     {
         var tmp = q;
         q = null;
         if (Link != null)
         {
             Link.Link = null;
         }
         if (Link != null && Link.ConnectionClosed != null)
         {
             Link.ConnectionClosed();
         }
         Link = null;
         Monitor.Pulse(tmp);
     }
 }
예제 #2
0
        public static Tuple <P2P, P2P> GeneratePair(Packet.IProvider p)
        {
            var p1 = new P2P(p);
            var p2 = new P2P(p);

            p1.Link = p2;
            p2.Link = p1;
            return(new Tuple <P2P, P2P>(p1, p2));
        }