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="$*"
|
||||
NARGS=$#
|
||||
|
||||
RESULT=""
|
||||
NFOUND=0
|
||||
while [ $NFOUND -lt $NARGS ]; do
|
||||
while :; do
|
||||
set $ARGS
|
||||
INDEX=$(($RANDOM % $NARGS))
|
||||
shift $INDEX
|
||||
VAL=$1
|
||||
[ x = "${RESULT/*$VAL*/x}" ] || break
|
||||
done
|
||||
# hack so 0 always comes out first
|
||||
RESULT="0"
|
||||
NARGS=$((NARGS-1))
|
||||
ARGS=${ARGS/0/}
|
||||
|
||||
RESULT="$RESULT $VAL"
|
||||
NFOUND=$((NFOUND+1))
|
||||
done
|
||||
if [ $NARGS -gt 0 ]; then
|
||||
NFOUND=0
|
||||
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
|
||||
}
|
||||
|
@ -170,6 +177,7 @@ do_one() {
|
|||
game_gtk $NAME $COOKIE $WAIT $INDEX \
|
||||
"-s $REMOTES"
|
||||
fi
|
||||
sleep 2 # ensure host connects first
|
||||
;;
|
||||
1)
|
||||
sleep $CONN_WAIT
|
||||
|
|
Loading…
Reference in a new issue