Skip to content

Commit

Permalink
Add ping to sync-block
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaarreell committed Nov 30, 2023
1 parent 34c128a commit 6da744b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/sync/sync-block
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function is_blocked() {
else
# read the status file over the network
debug "reading statuses from $PROVIDER"
$SYNC_DEBUG && ping -c 1 $PROVIDER
ncat --recv-only $PROVIDER $PORT 2> /dev/null > $TMPFILE
fi

Expand Down Expand Up @@ -104,15 +105,15 @@ function is_blocked() {

ROUND=1
DELAYS="1 1 2 3 5 8 13 21"
echo -n "Checking status - round $ROUND: "
echo -n "Checking status - round $ROUND - $(date +'%T')"

while is_blocked "$@"; do
echo "BLOCKED"
DELAY=${DELAYS%% *} # current delay
DELAYS=${DELAYS#* } # cut-off current delay for DELAYS list (except the last one)
sleep $DELAY
ROUND=$(( $ROUND+1 ))
echo -n "Checking status - round $ROUND: "
echo -n "Checking status - round $ROUND - $(date +'%T')"
done

echo "UNBLOCKED"

0 comments on commit 6da744b

Please sign in to comment.