Create 0001-tunneldigger-client-reset_broken_brokers.patch

This commit is contained in:
Claus Marxmeier 2019-03-25 19:25:44 +01:00 committed by GitHub
parent a52d5ced54
commit d2219189d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
diff --git a/client/l2tp_client.c b/client/l2tp_client.c
index 16fdf3c..69ce54c 100644
--- a/client/l2tp_client.c
+++ b/client/l2tp_client.c
@@ -1431,10 +1431,6 @@ int main(int argc, char **argv)
// Reset availability information and standby setting.
for (i = 0; i < broker_cnt; i++) {
- // Re-enable all brokers if they are all broken
- if (working_brokers == 0) {
- brokers[i].broken = 0;
- }
if (brokers[i].broken) {
// Inhibit hostname resolution and connect process.
syslog(LOG_INFO, "Not trying %s:%s again as it broke last time we tried.",
@@ -1442,11 +1438,6 @@ int main(int argc, char **argv)
brokers[i].ctx->state = STATE_FAILED;
}
}
- // Adapt working_brokers, needs updating if we re-enabled brokers
- if (working_brokers == 0) {
- syslog(LOG_INFO, "All brokers sent us an error, trying them all again.");
- working_brokers = broker_cnt;
- }
// Perform broker processing for 10 seconds or until all brokers are ready
// (whichever is shorter); since all contexts are in standby mode, all
@@ -1476,6 +1467,11 @@ int main(int argc, char **argv)
if (i == -1) {
syslog(LOG_ERR, "No suitable brokers found. Retrying in 5 seconds");
sleep(5);
+ // Un-break all brokers. There is no point in avoiding bad brokers if that means
+ // we have no candidates left.
+ for (i = 0; i < broker_cnt; i++) {
+ brokers[i].broken = 0;
+ }
continue;
}