Introduction
Introduction Statistics Contact Development Disclaimer Help
Add massive new retry framework for annna. - annna - Annna the nice friendly bo…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit b84504ef6c43259e07c62936922b829577204187
parent 03a116d4179a0502cf3b36244c46d4a83e8615e7
Author: Annna Robert-Houdin <[email protected]>
Date: Sat, 25 Feb 2023 09:20:11 +0100
Add massive new retry framework for annna.
Diffstat:
M annna-join-channels | 7 +++++++
M annna-start-main | 32 ++++++++++++++++++++++++-----…
2 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/annna-join-channels b/annna-join-channels
@@ -10,6 +10,7 @@ channels="$2"
export ircuser="$(cat ${cfgbase}/${server}/ircuser 2>/dev/null)"
+maxretries=10
# Channels
for chan in ${channels};
do
@@ -19,18 +20,24 @@ do
sleep 1
## Make sure the pipes are there.
+ tries=0
while [ ! -e "${ircbase}/${server}/${chan}/out" ];
do
[ ! -f ${cfgbase}/running ] && exit 1
+ tries=$(($tries + 1))
+ [ $tries -gt $maxretries ] && exit 1
sleep 1
done
+ tries=0
## Check if we have joined and received the message from the server.
while [ -z "$(cat ${ircbase}/${server}/${chan}/out \
| head -n 1 \
| grep ".* ${ircuser}.* ${chan}.*")" ];
do
[ ! -f ${cfgbase}/running ] && exit 1
+ tries=$(($tries + 1))
+ [ $tries -gt $maxretries ] && exit 1
sleep 2
done
diff --git a/annna-start-main b/annna-start-main
@@ -11,7 +11,10 @@ usetls="$2"
port="$3"
channels="$4"
+maxtries=10
+maxnicktries=5
{
+ nicktries=0
while [ -f ${cfgbase}/running ];
do
# Connect
@@ -46,35 +49,50 @@ channels="$4"
# -f "${fullname}" -p ${port} &
ii -s "${server}"${ircpassparam}${ircuserparam}${tlsparam} \
- -f "${fullname}" -p ${port} 2>&1 >/dev/null &
+ -f "${fullname}" -p ${port} 2>&1 >/dev/null &
iipid=$!
sleep 5
+ tries=0
## Waiting for the socket to be available.
while [ ! -e ${ircbase}/${server}/out ];
do
kill -0 $iipid >/dev/null 2>&1 || exit 1
[ ! -f ${cfgbase}/running ] && exit 1
+ set -x
+ tries=$(($tries + 1))
+ [ $tries -gt $maxtries ] && break
sleep 4
done
+ [ $tries -gt $maxtries ] && continue
+ set +x
# 433: Nickname is already in use.
- if [ -n "$(grep " 433 " ${ircbase}/${server}/out)" ];
+ if [ $(grep " 433 " ${ircbase}/${server}/out) ];
then
- exit 3
+ set -x
+ nicktries=$(($nicktries + 1))
+ [ $nicktries -gt $maxnicktries ] && exit 3
+ sleep 30
+ set +x
fi
- {
- annna-join-channels "${server}" "${channels}"
- } &
-
+ tries=0
# Check for end of motd.
while [ -z "$(grep " 376 " ${ircbase}/${server}/out)" ];
do
[ ! -f ${cfgbase}/running ] && exit 1
+ set -x
+ [ $tries -gt $maxtries ] && break
sleep 2
done
+ [ $tries -gt $maxtries ] && continue
+ set +x
+
+ {
+ annna-join-channels "${server}" "${channels}"
+ } &
# Watch for ii to exit. Then remove the used directory to have…
# services disappear.
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.