mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
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:
parent
c893fd4a9e
commit
9f7c0db09f
1 changed files with 21 additions and 13 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue