improve testing of proxy delete by saving up a number of relayIDs and

sending with multiple -d flags to rq.
This commit is contained in:
Eric House 2011-08-16 19:44:37 -07:00
parent dc273c7162
commit c2c673e932

View file

@ -225,11 +225,17 @@ close_device() {
unset ROOMS[$ID] unset ROOMS[$ID]
} }
OBITS=""
kill_from_log() { kill_from_log() {
LOG=$1 LOG=$1
RELAYID=$(./scripts/relayID.sh --long $LOG) RELAYID=$(./scripts/relayID.sh --long $LOG)
if [ -n "$RELAYID" ]; then if [ -n "$RELAYID" ]; then
../relay/rq -a $HOST -d $RELAYID 2>/dev/null || true OBITS="$OBITS -d $RELAYID"
if [ 0 -eq $(($RANDOM%2)) ]; then
../relay/rq -a $HOST $OBITS 2>/dev/null || true
OBITS=""
fi
return 0 # success return 0 # success
fi fi
echo "unable to send kill command for $LOG" echo "unable to send kill command for $LOG"
@ -281,10 +287,15 @@ check_game() {
close_device $ID $DONEDIR "game over" close_device $ID $DONEDIR "game over"
done done
date date
# XWRELAY_ERROR_DELETED may be old
elif grep -q 'relay_error_curses(XWRELAY_ERROR_DELETED)' $LOG; then elif grep -q 'relay_error_curses(XWRELAY_ERROR_DELETED)' $LOG; then
echo "deleting $LOG $(connName $LOG) b/c another resigned" echo "deleting $LOG $(connName $LOG) b/c another resigned"
kill_from_log $LOG || true kill_from_log $LOG || true
close_device $KEY $DEADDIR "other resigned" close_device $KEY $DEADDIR "other resigned"
elif grep -q 'relay_error_curses(XWRELAY_ERROR_DEADGAME)' $LOG; then
echo "deleting $LOG $(connName $LOG) b/c another resigned"
kill_from_log $LOG || true
close_device $KEY $DEADDIR "other resigned"
else else
maybe_resign $KEY maybe_resign $KEY
fi fi
@ -334,6 +345,8 @@ run_cmds() {
fi fi
done done
[ -n "$OBITS" ] && ../relay/rq -a $HOST $OBITS 2>/dev/null || true
# kill any remaining games # kill any remaining games
if [ $COUNT -gt 0 ]; then if [ $COUNT -gt 0 ]; then
mkdir -p ${LOGDIR}/not_done mkdir -p ${LOGDIR}/not_done