Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(electron): ♻️ use async model for ChildProcessHelper #1455

Merged
merged 2 commits into from Oct 28, 2022

Conversation

jyyi1
Copy link
Contributor

@jyyi1 jyyi1 commented Oct 26, 2022

In this PR, I refactored ChildProcessHelper to use the async model when launching new child process, to replace the old event model. So the caller can get out the exit code more easily. As a side effect of this refactoring, I used ChildProcessHelper to implement the checkConnectivity feature in GoVpnTunnel, I also fixed #1449 by reading the exit code from ChildProcessHelper.

@jyyi1 jyyi1 self-assigned this Oct 26, 2022
@jyyi1 jyyi1 force-pushed the junyi/fix-go-tunnel-exit-code branch from 69926a8 to b4a4e96 Compare October 27, 2022 03:12
@jyyi1 jyyi1 force-pushed the junyi/fix-go-tunnel-exit-code branch from b4a4e96 to cdc6f05 Compare October 27, 2022 03:44
@jyyi1 jyyi1 marked this pull request as ready for review October 27, 2022 04:27
@jyyi1 jyyi1 requested a review from a team as a code owner October 27, 2022 04:27
@jyyi1 jyyi1 requested a review from fortuna October 27, 2022 04:27
src/electron/go_vpn_tunnel.ts Outdated Show resolved Hide resolved
src/electron/process.ts Outdated Show resolved Hide resolved
src/electron/process.ts Outdated Show resolved Hide resolved
src/electron/go_vpn_tunnel.ts Outdated Show resolved Hide resolved
src/electron/go_vpn_tunnel.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot added size/L and removed size/M labels Oct 27, 2022
@jyyi1 jyyi1 force-pushed the junyi/fix-go-tunnel-exit-code branch from 4dc8ff3 to d85907c Compare October 27, 2022 21:45
@jyyi1 jyyi1 requested a review from fortuna October 27, 2022 21:48
Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

} catch (e) {
console.error(`tun2socks terminated due to ${e}`);
}
} while (!this.stopRequested && autoRestart);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the nested start calls, nice! I was worried about the stack growth.

@jyyi1 jyyi1 merged commit d784712 into master Oct 28, 2022
@jyyi1 jyyi1 deleted the junyi/fix-go-tunnel-exit-code branch October 28, 2022 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go-tun2socks connection error
2 participants