Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy

This commit is contained in:
eehouse@eehouse.org 2010-10-06 05:22:10 -07:00 committed by Andy2
commit 46ff3c3b68
3 changed files with 23 additions and 11 deletions

View file

@ -1226,13 +1226,13 @@ curses_util_askPassword( XW_UtilCtxt* XP_UNUSED(uc),
static void
curses_util_yOffsetChange( XW_UtilCtxt* XP_UNUSED(uc),
XP_U16 XP_UNUSED_DBG(maxOffset),
XP_U16 oldOffset, XP_U16 newOffset )
XP_U16 XP_UNUSED(maxOffset),
XP_U16 XP_UNUSED(oldOffset), XP_U16 XP_UNUSED(newOffset) )
{
if ( oldOffset != newOffset ) {
XP_WARNF( "curses_util_yOffsetChange(%d,%d,%d) not implemented",
maxOffset, oldOffset, newOffset );
}
/* if ( oldOffset != newOffset ) { */
/* XP_WARNF( "curses_util_yOffsetChange(%d,%d,%d) not implemented", */
/* maxOffset, oldOffset, newOffset ); */
/* } */
} /* curses_util_yOffsetChange */
static XP_Bool

View file

@ -64,6 +64,7 @@ build_cmds() {
for DEV in $(seq $NDEVS); do
FILE="${LOGDIR}/GAME_${GAME}_${DEV}.xwg"
LOG=${LOGDIR}/${GAME}_${DEV}_LOG.txt
touch $LOG # so greps won't show errors
CMD="./obj_linux_memdbg/xwords -C $ROOM -r ${NAMES[$DEV]} $OTHERS"
CMD="$CMD -d dict.xwd -p $PORT -a $HOST -f $FILE -z 1:3 $PLAT_PARMS"
CMDS[$COUNTER]=$CMD
@ -86,13 +87,14 @@ close_device() {
if [ ${PIDS[$ID]} -ne 0 ]; then
kill ${PIDS[$ID]}
fi
echo -n "closing $ID (log ${LOGS[$ID]}): "
date
unset PIDS[$ID]
unset CMDS[$ID]
mv ${FILES[$ID]} $DONEDIR
unset FILES[$ID]
mv ${LOGS[$ID]} $DONEDIR
unset LOGS[$ID]
echo "closed $ID"
}
check_game() {
@ -101,14 +103,14 @@ check_game() {
CONNNAME="$(connName $LOG)"
unset OTHERS
if [ -n "$CONNNAME" ]; then
if grep -q 'all remaining tiles' $LOG; then
if grep -q '\[unused tiles\]' $LOG; then
ALL_DONE=TRUE
for INDX in ${!LOGS[*]}; do
[ $INDX -eq $KEY ] && continue
ALOG=${LOGS[$INDX]}
CONNNAME2="$(connName $ALOG)"
if [ "$CONNNAME2" = "$CONNNAME" ]; then
if ! grep -q 'all remaining tiles' $ALOG; then
if ! grep -q '\[unused tiles\]' $ALOG; then
unset OTHERS
break
fi
@ -126,9 +128,11 @@ check_game() {
}
run_cmds() {
ENDTIME=$(($(date +%s) + TIMEOUT))
while :; do
COUNT=${#CMDS[*]}
[ 0 -ge $COUNT ] && break
[ $(date +%s) -ge $ENDTIME ] && break
INDX=$(($RANDOM%COUNT))
KEYS=( ${!CMDS[*]} )
KEY=${KEYS[$INDX]}
@ -142,6 +146,14 @@ run_cmds() {
check_game $KEY
fi
done
# kill any remaining games
for PID in ${PIDS[*]}; do
if [ $PID -ne 0 ]; then
echo "$PID still alive; killing..."
kill $PID
fi
done
}
print_stats() {
@ -153,3 +165,5 @@ run_cmds
print_stats
wait
echo -n "$0 done: "
date

View file

@ -423,7 +423,6 @@ XWThreadPool::grab_elem_locked( QueuePr* prp )
void
XWThreadPool::release_socket_locked( int socket )
{
logf( XW_LOGINFO, "%s(%d)", __func__, socket );
if ( -1 != socket ) {
set<int>::iterator iter = m_sockets_in_use.find( socket );
assert( iter != m_sockets_in_use.end() );
@ -443,5 +442,4 @@ XWThreadPool::print_in_use( void )
iter != m_sockets_in_use.end(); ++iter ) {
len += snprintf( &buf[len], sizeof(buf)-len, "%d ", *iter );
}
logf( XW_LOGINFO, "%s: %s", __func__, buf );
}