示例#1
0
        public static void RelayBiDirectionally(Socket s1, Socket s2)
        {
            var relayOne = new SocketRelay(s1, s2);
            var relayTwo = new SocketRelay(s2, s1);

            relayOne.Other = relayTwo;
            relayTwo.Other = relayOne;

            Task.Run(relayOne.Process);
            Task.Run(relayTwo.Process);
        }
示例#2
0
        private void OnCleanup()
        {
            if (Disposed)
            {
                return;
            }

            Disposed = ShouldDispose = true;

            Other.ShouldDispose = true;
            Other = null;

            Source.TryDispose();
            Target.TryDispose();
            RecSAEA.TryDispose();
            SendSAEA.TryDispose();

            Source  = Target = null;
            RecSAEA = SendSAEA = null;
            Buffer  = null;
        }