mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
use new comms_ackAny() call to send ACKs at points where currently
resendAll is being called. Dramatically reduces SMS message count when app is being relaunched and backgrounded between turns.
This commit is contained in:
parent
416a1054a7
commit
1134f71b7b
7 changed files with 22 additions and 1 deletions
|
@ -15,6 +15,7 @@ local_DEFINES += \
|
|||
$(local_DEBUG) \
|
||||
-DXWFEATURE_RELAY \
|
||||
-DXWFEATURE_SMS \
|
||||
-DXWFEATURE_COMMSACK \
|
||||
-DXWFEATURE_TURNCHANGENOTIFY \
|
||||
-DXWFEATURE_CHAT \
|
||||
-DCOMMS_XPORT_FLAGSPROC \
|
||||
|
|
|
@ -14,6 +14,7 @@ local_LDLIBS += -llog
|
|||
local_DEFINES += \
|
||||
$(local_DEBUG) \
|
||||
-DXWFEATURE_RELAY \
|
||||
-DXWFEATURE_COMMSACK \
|
||||
-DXWFEATURE_TURNCHANGENOTIFY \
|
||||
-DXWFEATURE_CHAT \
|
||||
-DCOMMS_XPORT_FLAGSPROC \
|
||||
|
|
|
@ -1267,6 +1267,18 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll
|
|||
XWJNI_END();
|
||||
}
|
||||
|
||||
#ifdef XWFEATURE_COMMSACK
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1ackAny
|
||||
( JNIEnv* env, jclass C, jint gamePtr )
|
||||
{
|
||||
XWJNI_START();
|
||||
XP_ASSERT( !!state->game.comms );
|
||||
(void)comms_ackAny( state->game.comms );
|
||||
XWJNI_END();
|
||||
}
|
||||
#endif
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1transportFailed
|
||||
( JNIEnv* env, jclass C, jint gamePtr )
|
||||
|
|
|
@ -224,7 +224,7 @@ public class CommsTransport implements TransportProcs,
|
|||
|
||||
public void tickle()
|
||||
{
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND );
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND_ACK );
|
||||
// CommsAddrRec addr = new CommsAddrRec( m_context );
|
||||
// XwJNI.comms_getAddr( m_jniGamePtr, addr );
|
||||
// switch( addr.conType ) {
|
||||
|
|
|
@ -679,6 +679,7 @@ public class GameUtils {
|
|||
|| draw;
|
||||
}
|
||||
}
|
||||
XwJNI.comms_ackAny( gamePtr );
|
||||
|
||||
// update gi to reflect changes due to messages
|
||||
XwJNI.game_getGi( gamePtr, gi );
|
||||
|
|
|
@ -76,6 +76,7 @@ public class JNIThread extends Thread {
|
|||
CMD_COUNTS_VALUES,
|
||||
CMD_REMAINING,
|
||||
CMD_RESEND,
|
||||
CMD_RESEND_ACK,
|
||||
CMD_HISTORY,
|
||||
CMD_FINAL,
|
||||
CMD_ENDGAME,
|
||||
|
@ -480,6 +481,10 @@ public class JNIThread extends Thread {
|
|||
case CMD_RESEND:
|
||||
XwJNI.comms_resendAll( m_jniGamePtr );
|
||||
break;
|
||||
case CMD_RESEND_ACK:
|
||||
XwJNI.comms_resendAll( m_jniGamePtr );
|
||||
XwJNI.comms_ackAny( m_jniGamePtr );
|
||||
break;
|
||||
|
||||
case CMD_HISTORY:
|
||||
boolean gameOver = XwJNI.server_getGameIsOver( m_jniGamePtr );
|
||||
|
|
|
@ -230,6 +230,7 @@ public class XwJNI {
|
|||
public static native void comms_getAddr( int gamePtr, CommsAddrRec addr );
|
||||
public static native void comms_setAddr( int gamePtr, CommsAddrRec addr );
|
||||
public static native void comms_resendAll( int gamePtr );
|
||||
public static native void comms_ackAny( int gamePtr );
|
||||
public static native void comms_transportFailed( int gamePtr );
|
||||
public static native boolean comms_isConnected( int gamePtr );
|
||||
|
||||
|
|
Loading…
Reference in a new issue