private void WaitForTranseiviersToShutDown()
        {
            var startedWaitingAt = DateTime.UtcNow;

            while ((_transmitter != null && _transmitter.Sending) || (_receiver != null && _receiver.Receiving))
            {
                if ((DateTime.UtcNow - startedWaitingAt) > _options.ShutdownWait)
                {
                    break;
                }

                Thread.Sleep(10);
            }

            _transmitter?.Dispose();
            _receiver?.Dispose();
        }
示例#2
0
        private void WaitForTranseiviersToShutDown()
        {
            DateTime startedWaitingAt = DateTime.UtcNow;

            while ((_transmitter != null && _transmitter.Sending) || (_receiver != null && _receiver.Receiving))
            {
                if ((DateTime.UtcNow - startedWaitingAt).TotalMilliseconds > _options.ShutdownWait)
                {
                    break;
                }

                Thread.Sleep(10);
            }

            if (_transmitter != null)
            {
                _transmitter.Dispose();
            }
            if (_receiver != null)
            {
                _receiver.Dispose();
            }
        }