Beispiel #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(new Action(relayOne.Process));
            Task.Run(new Action(relayTwo.Process));
        }
Beispiel #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;
        }