call feedMessages even if there are no messages, and call

comms_resendAll() from feedMessages.  The combination means that all
networked games get a chance to resend dropped packets periodically
which should help prevent stalls.
This commit is contained in:
Andy2 2011-08-17 19:51:20 -07:00
parent 08789c4097
commit 8e6812780d
2 changed files with 11 additions and 8 deletions

View file

@ -863,8 +863,13 @@ public class GameUtils {
if ( lock.tryLock() ) {
loadMakeGame( context, gamePtr, gi, feedImpl, sink, lock );
for ( byte[] msg : msgs ) {
draw = XwJNI.game_receiveMessage( gamePtr, msg ) || draw;
XwJNI.comms_resendAll( gamePtr );
if ( null != msgs ) {
for ( byte[] msg : msgs ) {
draw = XwJNI.game_receiveMessage( gamePtr, msg )
|| draw;
}
}
// update gi to reflect changes due to messages
@ -891,7 +896,7 @@ public class GameUtils {
}
Utils.logf( "feedMessages=>%b", draw );
return draw;
}
} // feedMessages
// This *must* involve a reset if the language is changing!!!
// Which isn't possible right now, so make sure the old and new

View file

@ -121,11 +121,9 @@ public class RelayService extends Service {
for ( int ii = 0; ii < nameCount; ++ii ) {
// if game has messages, open it and feed 'em
// to it.
if ( null != msgs[ii] ) {
if ( GameUtils.feedMessages( this, ids[ii],
msgs[ii], sink ) ) {
idsWMsgs.add( ids[ii] );
}
if ( GameUtils.feedMessages( this, ids[ii],
msgs[ii], sink ) ) {
idsWMsgs.add( ids[ii] );
}
}
if ( 0 < idsWMsgs.size() ) {