SadeghHayeri/GreenTunnel

No Internet when PC start if Green Tunnel was on and wasn't closed manually before shutdown

fx-pro opened this issue · 4 comments

fx-pro commented

Scenario:

  • Open Green Tunnel.
  • Turn it On.
  • Shutdown PC (Green Tunnel will be force closed automatically).
  • Start PC again (without GT in startup).
  • No Internet connection.

Suggest solution:
Green Tunnel go Off if closed by Windows when shutdown.

Thank you very much for such a great app!

musjj commented

The program manually sets the system's proxy settings (as seen in src/utils/system-proxy.js) when you run it. If you exit cleanly, it will turn it back off, but otherwise the proxy settings will be left as it was when the program was running.
I don't think there's anything that Green Tunnel can do about this, but I suppose it can provide a convenient command line option to toggle the proxy.

fx-pro commented

@musjj
Thank you for your kindly support. I understand that GTunnel set the proxy for the system, and it isn't clean up when closed by Windows when Shutdown.
But Windows don't kill all the processes immediately when PC shutdown, however, it send signal to all running process to let them deal with it/clean up...

In node.js application, we can handle those signals likes:

function shutdownHandler(signal) {
    // do some stuff here
    
   await unsetProxy();
    
   //process.exit()
}

process.on('SIGINT', shutdownHandler)
process.on('SIGTERM', shutdownHandler)
process.on('SIGQUIT', shutdownHandler)

Thank you,

@musjj
How do you exit 'cleanly' like in your comment? Now I have to turn gt from my terminal to connect to the App Store every time.