mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
[Fix] A better fix for Issue #129
This commit is contained in:
parent
1074ac0882
commit
2f6c829e70
@ -1 +1 @@
|
|||||||
471
|
485
|
||||||
|
@ -231,18 +231,21 @@ namespace Qv2ray
|
|||||||
|
|
||||||
// Note: The part below always makes the whole functionality in trouble......
|
// Note: The part below always makes the whole functionality in trouble......
|
||||||
// BE EXTREME CAREFUL when changing these code below...
|
// BE EXTREME CAREFUL when changing these code below...
|
||||||
|
|
||||||
// See: https://github.com/lhy0403/Qv2ray/issues/129
|
// See: https://github.com/lhy0403/Qv2ray/issues/129
|
||||||
// routeCountLabel in Mainwindow makes here failed to ENOUGH-ly check the routing tables
|
// routeCountLabel in Mainwindow makes here failed to ENOUGH-ly check the routing tables
|
||||||
if (!root.contains("routing") || root["routing"].toArray().count() == 0) {
|
bool cRouting = root.contains("routing");
|
||||||
// For SOME configs, there is no "route" entries, so, we add some...
|
bool cRule = cRouting && root["routing"].toObject().contains("rules");
|
||||||
|
bool cRules = cRule && root["routing"].toObject()["rules"].toArray().count() > 0;
|
||||||
|
|
||||||
|
if (!cRules) {
|
||||||
|
LOG(MODULE_CONNECTION, "Current connection has NO ROUTING section, we insert default values.")
|
||||||
|
|
||||||
if (root["outbounds"].toArray().count() != 1) {
|
if (root["outbounds"].toArray().count() != 1) {
|
||||||
// There are no ROUTING but 2 or more outbounds.... This is rare, but possible.
|
// There are no ROUTING but 2 or more outbounds.... This is rare, but possible.
|
||||||
LOG(MODULE_CONNECTION, "WARN: This message usually indicates the config file has some logic errors:")
|
LOG(MODULE_CONNECTION, "WARN: This message usually indicates the config file has some logic errors:")
|
||||||
LOG(MODULE_CONNECTION, "WARN: --> The config file has NO routing section, however more than 1 outbounds are detected.")
|
LOG(MODULE_CONNECTION, "WARN: --> The config file has NO routing section, however more than 1 outbounds are detected.")
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(MODULE_CONNECTION, "Current connection has NO ROUTING section, we insert default values.")
|
|
||||||
auto routeObject = GenerateRoutes(gConf.enableProxy, gConf.bypassCN);
|
auto routeObject = GenerateRoutes(gConf.enableProxy, gConf.bypassCN);
|
||||||
root.insert("routing", routeObject);
|
root.insert("routing", routeObject);
|
||||||
QJsonArray outbounds = root["outbounds"].toArray();
|
QJsonArray outbounds = root["outbounds"].toArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user