Always launch host first, sleep to make sure it'll be connected and

the room registered before launching any guests.
This commit is contained in:
ehouse 2009-12-04 08:56:51 +00:00
parent c893fd4a9e
commit 9f7c0db09f

View file

@ -115,20 +115,27 @@ rearrange() {
ARGS="$*" ARGS="$*"
NARGS=$# NARGS=$#
RESULT="" # hack so 0 always comes out first
NFOUND=0 RESULT="0"
while [ $NFOUND -lt $NARGS ]; do NARGS=$((NARGS-1))
while :; do ARGS=${ARGS/0/}
set $ARGS
INDEX=$(($RANDOM % $NARGS))
shift $INDEX
VAL=$1
[ x = "${RESULT/*$VAL*/x}" ] || break
done
RESULT="$RESULT $VAL" if [ $NARGS -gt 0 ]; then
NFOUND=$((NFOUND+1)) NFOUND=0
done while [ $NFOUND -lt $NARGS ]; do
while :; do
set $ARGS
INDEX=$(($RANDOM % $NARGS))
shift $INDEX
VAL=$1
# test that VAL's not yet in result
[ x = "${RESULT/*$VAL*/x}" ] || break
done
RESULT="$RESULT $VAL"
NFOUND=$((NFOUND+1))
done
fi
echo $RESULT echo $RESULT
} }
@ -170,6 +177,7 @@ do_one() {
game_gtk $NAME $COOKIE $WAIT $INDEX \ game_gtk $NAME $COOKIE $WAIT $INDEX \
"-s $REMOTES" "-s $REMOTES"
fi fi
sleep 2 # ensure host connects first
;; ;;
1) 1)
sleep $CONN_WAIT sleep $CONN_WAIT