aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-05-27 18:25:58 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-05-27 18:25:58 +0300
commit117dd31d5322c071b4b348b61b0ef741a6044926 (patch)
treea1fdd788c6506d6bda2830dd7f64546ed691df10
parent167d53f27fb9720386de7349a81d2451acc00fbe (diff)
downloadarching-kaos-tools-117dd31d5322c071b4b348b61b0ef741a6044926.tar.gz
arching-kaos-tools-117dd31d5322c071b4b348b61b0ef741a6044926.tar.bz2
arching-kaos-tools-117dd31d5322c071b4b348b61b0ef741a6044926.zip
Added hardcoded timeout for curl calls
-rwxr-xr-xlib/_ak_zblock14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/_ak_zblock b/lib/_ak_zblock
index e1e6914..cb6af36 100755
--- a/lib/_ak_zblock
+++ b/lib/_ak_zblock
@@ -601,7 +601,12 @@ _ak_zblock_pack(){
_ak_zblock_announce(){
if [ ! -z "$1" ] && [ -n "$1" ]
then
- curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$1'"}' 2>/dev/null | jq -M -c > /dev/null
+ curl \
+ --connect-timeout 3 \
+ --header 'Content-Type: application/json' \
+ --data-raw '{"zblock":"'$1'"}' \
+ "http://127.0.0.1:8610/v0/announce/zblock" \
+ 2>/dev/null | jq -M -c > /dev/null
if [ $? -ne 0 ]
then
logit "ERROR" "zblock $zblock announcement failed"
@@ -609,7 +614,12 @@ _ak_zblock_announce(){
logit "INFO" "zblock $zblock announced"
fi
else
- curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak-get-zlatest)'"}' 2>/dev/null | jq -M -c > /dev/null
+ curl \
+ --connect-timeout 3 \
+ --header 'Content-Type: application/json' \
+ --data-raw '{"zblock":"'$(ak-get-zlatest)'"}' \
+ "http://127.0.0.1:8610/v0/announce/zblock" \
+ 2>/dev/null | jq -M -c > /dev/null
if [ $? -ne 0 ]
then
logit "ERROR" "zblock $zblock announcement failed"