mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Feat: Allow manually restarting the core when Tun is misbehaving
This commit is contained in:
parent
f7fc4d16da
commit
811764d6eb
@ -141,15 +141,6 @@ namespace NekoGui_sys {
|
||||
|
||||
void CoreProcess::Start() {
|
||||
show_stderr = false;
|
||||
// set extra env
|
||||
auto v2ray_asset_dir = NekoGui::FindCoreAsset("geoip.dat");
|
||||
if (!v2ray_asset_dir.isEmpty()) {
|
||||
v2ray_asset_dir = QFileInfo(v2ray_asset_dir).absolutePath();
|
||||
env << "XRAY_LOCATION_ASSET=" + v2ray_asset_dir;
|
||||
}
|
||||
if (NekoGui::dataStore->core_ray_direct_dns) env << "NKR_CORE_RAY_DIRECT_DNS=1";
|
||||
if (NekoGui::dataStore->core_ray_windows_disable_auto_interface) env << "NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE=1";
|
||||
//
|
||||
ExternalProcess::Start();
|
||||
write((NekoGui::dataStore->core_token + "\n").toUtf8());
|
||||
}
|
||||
|
||||
@ -304,10 +304,21 @@ void MainWindow::neko_start(int _id) {
|
||||
//
|
||||
bool rpcOK;
|
||||
QString error = defaultClient->Start(&rpcOK, req);
|
||||
if (rpcOK && !error.isEmpty()) {
|
||||
runOnUiThread([=] { MessageBoxWarning("LoadConfig return error", error); });
|
||||
if (!rpcOK) {
|
||||
return false;
|
||||
} else if (!rpcOK) {
|
||||
}
|
||||
if (!error.isEmpty()) {
|
||||
if (error.contains("configure tun interface")) {
|
||||
auto r = QMessageBox::information(this, tr("Tun device misbehaving"),
|
||||
tr("If you have trouble starting VPN, you can force reset nekobox_core process here and then try starting the profile again."),
|
||||
tr("Reset"), tr("Cancel"), "",
|
||||
1, 1);
|
||||
if (r == 0) {
|
||||
GetMainWindow()->StopVPNProcess(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
runOnUiThread([=] { MessageBoxWarning("LoadConfig return error", error); });
|
||||
return false;
|
||||
}
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user