add unquash menuitem to netstat menu (debug only)

This commit is contained in:
Eric House 2024-02-09 09:36:19 -08:00
parent cbae3665ca
commit a48cd6e82e
6 changed files with 19 additions and 5 deletions

View file

@ -1534,6 +1534,9 @@ public class BoardDelegate extends DelegateBase
popup.getMenu().removeItem( R.id.netstat_menu_traffic );
popup.getMenu().removeItem( R.id.netstat_peers );
}
if ( !m_summary.quashed ) {
popup.getMenu().removeItem( R.id.netstat_unquash );
}
popup.setOnMenuItemClickListener( new PopupMenu
.OnMenuItemClickListener() {
@ -1553,6 +1556,9 @@ public class BoardDelegate extends DelegateBase
case R.id.netstat_peers:
showDialogFragment( DlgID.MQTT_PEERS );
break;
case R.id.netstat_unquash:
XwJNI.comms_setQuashed( m_jniGamePtr, false );
break;
default:
handled = false;
}

View file

@ -1458,7 +1458,7 @@ public class GameUtils {
for ( long rowid: rowids ) {
try ( JNIThread thread = JNIThread.getRetained( rowid ) ) {
if ( null != thread ) {
XwJNI.comms_setQuashed( thread.getGamePtr() );
XwJNI.comms_setQuashed( thread.getGamePtr(), true );
// JNIThread saves automatically on release
} else {
try ( GameLock lock = GameLock.lock( rowid, 300 ) ) {
@ -1466,7 +1466,7 @@ public class GameUtils {
CurGameInfo gi = new CurGameInfo( context );
try ( GamePtr gamePtr = loadMakeGame( context, gi, lock ) ) {
if ( null != gamePtr ) {
if ( XwJNI.comms_setQuashed( gamePtr ) ) {
if ( XwJNI.comms_setQuashed( gamePtr, true ) ) {
saveGame( context, gamePtr, gi, lock, false );
}
}

View file

@ -560,7 +560,7 @@ public class XwJNI {
public static native CommsAddrRec comms_getHostAddr( GamePtr gamePtr );
public static native CommsAddrRec[] comms_getAddrs( GamePtr gamePtr );
public static native void comms_dropHostAddr( GamePtr gamePtr, CommsConnType typ );
public static native boolean comms_setQuashed( GamePtr gamePtr );
public static native boolean comms_setQuashed( GamePtr gamePtr, boolean quashed );
public static native int comms_resendAll( GamePtr gamePtr, boolean force,
CommsConnType filter,
boolean andAck );

View file

@ -13,4 +13,7 @@
<item android:id="@+id/netstat_peers"
android:title="@string/menu_about_peers"
/>
<item android:id="@+id/netstat_unquash"
android:title="@string/menu_unquash"
/>
</menu>

View file

@ -9,6 +9,11 @@
<string name="no_peers_info">Peers information not available</string>
<string name="button_refresh">Refresh</string>
<!-- In Known Players display, a checkbox to sort players by when
their most recent game started instead of by name -->
<string name="sort_by_date_label">Sort by date</string>
<!-- Debug-only: menu to remove quashed marking from a game (in case
the quashing was accidental) -->
<string name="menu_unquash">Unquash</string>
</resources>

View file

@ -2695,13 +2695,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1dropHostAddr
JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1setQuashed
( JNIEnv* env, jclass C, GamePtrType gamePtr )
( JNIEnv* env, jclass C, GamePtrType gamePtr, jboolean jQuashed )
{
jboolean result = false;
XWJNI_START(gamePtr);
XP_ASSERT( !!state->game.comms );
if ( NULL != state->game.comms ) {
result = comms_setQuashed( state->game.comms, env, XP_TRUE );
result = comms_setQuashed( state->game.comms, env, jQuashed );
}
XWJNI_END();
return result;