From patchwork Mon Oct 29 11:45:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: configurehood: Introduce random delays to dilute requests From: Adrian Schmutzler X-Patchwork-Id: 943 Message-Id: <20181029114500.1518-1-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Mon, 29 Oct 2018 12:45:00 +0100 Instead of having 1000 routers accessing the KeyXchange in the same second, this will dilute the request within a period of 10 seconds. Same is done for queries from gateways. Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 47e228b7..b6cae476 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -74,6 +74,7 @@ if [ -s "$hoodfilelocal" ]; then else # if we have Internet, we download the Hoodfile from the keyxchangev2 if hasInternet ; then + sleep $(/usr/bin/random 1 10) getKeyserverHoodfile "$hoodfiletmp" && cp "$hoodfiletmp" "$hoodfilewww" #if no Internet, we connect to the hidden AP and download the file from another Node in range @@ -95,6 +96,8 @@ else getEthernetHoodfile "$hoodfiletmp" || getWirelessHoodfile "$hoodfiletmp" else echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1" + + sleep $(/usr/bin/random 1 10) getGatewayHoodfile "$hoodfiletmp" && cp "$hoodfiletmp" "$hoodfilewww" fi fi