Skip to content

Commit

Permalink
* Time out the mirror check after a few seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
fewtarius committed Jul 13, 2024
1 parent 0671589 commit ec9856f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PKGBUILD/steamfork-customizations-jupiter/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pkgname=steamfork-customizations-jupiter
pkgver=2024.07.13
pkgrel=3
pkgrel=4
pkgdesc='SteamFork customizations provider.'
arch=('any')
url='http://www.steamfork.org'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (C) 2024-present Fewtarius

STAGING_MIRRORLIST="/tmp/steamfork-mirrors.txt"
CURL_OPTS="--connect-timeout 2 --max-time 2"

### Each mirror hashes its repository and provides the hash in the web root. Other
### nodes in the pool check each node's hash, and if they match the node is added
Expand All @@ -11,7 +12,7 @@ STAGING_MIRRORLIST="/tmp/steamfork-mirrors.txt"
DEFAULT_MIRRORS=( "www.steamfork.org" "www2.steamfork.org" "www3.steamfork.org" )
for MIRROR in ${DEFAULT_MIRRORS[@]}
do
curl -Lo ${STAGING_MIRRORLIST} https://${MIRROR}/mirrorlist.txt 2>/dev/null
curl -Lo ${STAGING_MIRRORLIST} ${CURL_OPTS} https://${MIRROR}/mirrorlist.txt 2>/dev/null
if [ "$?" = "0" ]
then
break
Expand All @@ -38,7 +39,7 @@ case ${1} in
for COUNT in $(seq 0 1 ${#MIRROR_LIST[@]})
do
SELECTED_MIRROR=${MIRROR_LIST[ $RANDOM % ${#MIRROR_LIST[@]}]}
curl -Lo /dev/null ${SELECTED_MIRROR}/mirrorlist.txt >/dev/null 2>&1
curl -Lo /dev/null ${CURL_OPTS} ${SELECTED_MIRROR}/mirrorlist.txt >/dev/null 2>&1
if [ "$?" = "0" ]
then
echo ${SELECTED_MIRROR}
Expand Down

0 comments on commit ec9856f

Please sign in to comment.