diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java index 92c476792..7bb484826 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java @@ -482,14 +482,12 @@ public class GameUtils { if ( force ) { HashMap games = DBUtils.getGamesWithSendsPending( context ); - if ( 0 < games.size() ) { - new ResendTask( context, games, filter, proc ).execute(); + new ResendTask( context, games, filter, proc ).execute(); - System.arraycopy( sendTimes, 0, /* src */ - sendTimes, 1, /* dest */ - sendTimes.length - 1 ); - sendTimes[0] = now; - } + System.arraycopy( sendTimes, 0, /* src */ + sendTimes, 1, /* dest */ + sendTimes.length - 1 ); + sendTimes[0] = now; } } @@ -1259,7 +1257,7 @@ public class GameUtils { private HashMap m_games; private ResendDoneProc m_doneProc; private CommsConnType m_filter; - private MultiMsgSink m_sink; + private int m_nSent = 0; public ResendTask( Context context, HashMap games, CommsConnType filter, ResendDoneProc proc ) @@ -1288,14 +1286,15 @@ public class GameUtils { GameLock lock = new GameLock( rowid, false ); if ( lock.tryLock() ) { CurGameInfo gi = new CurGameInfo( m_context ); - m_sink = new MultiMsgSink( m_context, rowid ); - GamePtr gamePtr = loadMakeGame( m_context, gi, m_sink, lock ); + MultiMsgSink sink = new MultiMsgSink( m_context, rowid ); + GamePtr gamePtr = loadMakeGame( m_context, gi, sink, lock ); if ( null != gamePtr ) { int nSent = XwJNI.comms_resendAll( gamePtr, true, m_filter, false ); gamePtr.release(); Log.d( TAG, "ResendTask.doInBackground(): sent %d " + "messages for rowid %d", nSent, rowid ); + m_nSent += sink.numSent(); } else { Log.d( TAG, "ResendTask.doInBackground(): loadMakeGame()" + " failed for rowid %d", rowid ); @@ -1320,8 +1319,7 @@ public class GameUtils { protected void onPostExecute( Void unused ) { if ( null != m_doneProc ) { - int nSent = null == m_sink ? 0 : m_sink.numSent(); - m_doneProc.onResendDone( m_context, nSent ); + m_doneProc.onResendDone( m_context, m_nSent ); } } }