public void Stop()
        {
            if (_stopped)
            {
                return;
            }

            _stopped = true;

            if (_listener != null)
            {
                _listener.Stop();
            }
            if (_xsocksRunner != null)
            {
                _xsocksRunner.Stop();
            }
            if (_polipoRunner != null)
            {
                _polipoRunner.Stop();
            }

            if (_config.Enabled)
            {
                SystemProxy.Update(_config, true);
            }
        }
 private void UpdateSystemProxy()
 {
     if (_config.Enabled)
     {
         SystemProxy.Update(_config, false);
         _systemProxyIsDirty = true;
     }
     else
     {
         // only switch it off if we have switched it on
         if (_systemProxyIsDirty)
         {
             SystemProxy.Update(_config, false);
             _systemProxyIsDirty = false;
         }
     }
 }