mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
correctly report number of pending moves resent
Was overwriting rather than accumulating.
This commit is contained in:
parent
e5ae940216
commit
11be66eb3f
1 changed files with 10 additions and 12 deletions
|
@ -482,14 +482,12 @@ public class GameUtils {
|
||||||
if ( force ) {
|
if ( force ) {
|
||||||
HashMap<Long,CommsConnTypeSet> games =
|
HashMap<Long,CommsConnTypeSet> games =
|
||||||
DBUtils.getGamesWithSendsPending( context );
|
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 */
|
System.arraycopy( sendTimes, 0, /* src */
|
||||||
sendTimes, 1, /* dest */
|
sendTimes, 1, /* dest */
|
||||||
sendTimes.length - 1 );
|
sendTimes.length - 1 );
|
||||||
sendTimes[0] = now;
|
sendTimes[0] = now;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,7 +1257,7 @@ public class GameUtils {
|
||||||
private HashMap<Long,CommsConnTypeSet> m_games;
|
private HashMap<Long,CommsConnTypeSet> m_games;
|
||||||
private ResendDoneProc m_doneProc;
|
private ResendDoneProc m_doneProc;
|
||||||
private CommsConnType m_filter;
|
private CommsConnType m_filter;
|
||||||
private MultiMsgSink m_sink;
|
private int m_nSent = 0;
|
||||||
|
|
||||||
public ResendTask( Context context, HashMap<Long,CommsConnTypeSet> games,
|
public ResendTask( Context context, HashMap<Long,CommsConnTypeSet> games,
|
||||||
CommsConnType filter, ResendDoneProc proc )
|
CommsConnType filter, ResendDoneProc proc )
|
||||||
|
@ -1288,14 +1286,15 @@ public class GameUtils {
|
||||||
GameLock lock = new GameLock( rowid, false );
|
GameLock lock = new GameLock( rowid, false );
|
||||||
if ( lock.tryLock() ) {
|
if ( lock.tryLock() ) {
|
||||||
CurGameInfo gi = new CurGameInfo( m_context );
|
CurGameInfo gi = new CurGameInfo( m_context );
|
||||||
m_sink = new MultiMsgSink( m_context, rowid );
|
MultiMsgSink sink = new MultiMsgSink( m_context, rowid );
|
||||||
GamePtr gamePtr = loadMakeGame( m_context, gi, m_sink, lock );
|
GamePtr gamePtr = loadMakeGame( m_context, gi, sink, lock );
|
||||||
if ( null != gamePtr ) {
|
if ( null != gamePtr ) {
|
||||||
int nSent = XwJNI.comms_resendAll( gamePtr, true,
|
int nSent = XwJNI.comms_resendAll( gamePtr, true,
|
||||||
m_filter, false );
|
m_filter, false );
|
||||||
gamePtr.release();
|
gamePtr.release();
|
||||||
Log.d( TAG, "ResendTask.doInBackground(): sent %d "
|
Log.d( TAG, "ResendTask.doInBackground(): sent %d "
|
||||||
+ "messages for rowid %d", nSent, rowid );
|
+ "messages for rowid %d", nSent, rowid );
|
||||||
|
m_nSent += sink.numSent();
|
||||||
} else {
|
} else {
|
||||||
Log.d( TAG, "ResendTask.doInBackground(): loadMakeGame()"
|
Log.d( TAG, "ResendTask.doInBackground(): loadMakeGame()"
|
||||||
+ " failed for rowid %d", rowid );
|
+ " failed for rowid %d", rowid );
|
||||||
|
@ -1320,8 +1319,7 @@ public class GameUtils {
|
||||||
protected void onPostExecute( Void unused )
|
protected void onPostExecute( Void unused )
|
||||||
{
|
{
|
||||||
if ( null != m_doneProc ) {
|
if ( null != m_doneProc ) {
|
||||||
int nSent = null == m_sink ? 0 : m_sink.numSent();
|
m_doneProc.onResendDone( m_context, m_nSent );
|
||||||
m_doneProc.onResendDone( m_context, nSent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue