From dc7064a168342664213d86ace5c4efa65a47cd79 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 22 Aug 2020 12:36:31 -0700 Subject: [PATCH] fix bug resulting in invitation droppage Recent changes in how nli address sets were stored led to rejecting incoming invitations when BT had been removed (e.g. on emulator) because I didn't notice the removal when validating. --- .../main/java/org/eehouse/android/xw4/NetLaunchInfo.java | 9 ++++++--- .../java/org/eehouse/android/xw4/XWServiceHelper.java | 9 ++++++++- xwords4/linux/mqttcon.c | 3 ++- xwords4/relay/scripts/mqtt-showinplay.py | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java index f0ec2c399..9eab7e334 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java @@ -1,4 +1,4 @@ -/* -*- compile-command: "find-and-gradle.sh inXw4Deb"; -*- */ +/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */ /* * Copyright 2009 - 2020 by Eric House (xwords@eehouse.org). All rights * reserved. @@ -572,8 +572,8 @@ public class NetLaunchInfo implements Serializable { } } - removeUnsupported( supported ); _conTypes = addrs.toInt(); + removeUnsupported( supported ); calcValid(); } @@ -748,7 +748,7 @@ public class NetLaunchInfo implements Serializable { iter.hasNext(); ) { CommsConnType typ = iter.next(); if ( !supported.contains( typ ) ) { - Log.d( TAG, "removing %s", typ ); + Log.d( TAG, "removeUnsupported(): removing %s", typ ); iter.remove(); } } @@ -778,6 +778,9 @@ public class NetLaunchInfo implements Serializable { valid = null != mqttDevID; break; } + if ( !valid ) { + Log.d( TAG, "valid after %s: %b", typ, valid ); + } } } m_valid = valid; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java index 169718497..2fd47463f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java @@ -127,7 +127,14 @@ abstract class XWServiceHelper { protected boolean handleInvitation( NetLaunchInfo nli, String device, DictFetchOwner dfo ) { - boolean success = nli.isValid() && checkNotInFlight( nli ); + boolean success = false; + if ( !nli.isValid() ) { + Log.d( TAG, "invalid nli" ); + } else if ( ! checkNotInFlight( nli ) ) { + Log.e( TAG, "checkNotInFlight() => false" ); + } else { + success = true; + } CurGameInfo gi = null; if ( success ) { long[] rowids = DBUtils.getRowIDsFor( mContext, nli.gameID() ); diff --git a/xwords4/linux/mqttcon.c b/xwords4/linux/mqttcon.c index 53e96ac2a..2b26eddc6 100644 --- a/xwords4/linux/mqttcon.c +++ b/xwords4/linux/mqttcon.c @@ -200,7 +200,8 @@ mqttc_init( LaunchParams* params ) int keepalive = 60; err = mosquitto_connect( mosq, params->connInfo.mqtt.hostName, params->connInfo.mqtt.port, keepalive ); - XP_LOGFF( "mosquitto_connect() => %s", mosquitto_strerror(err) ); + XP_LOGFF( "mosquitto_connect(host=%s) => %s", params->connInfo.mqtt.hostName, + mosquitto_strerror(err) ); if ( MOSQ_ERR_SUCCESS == err ) { int mid; err = mosquitto_subscribe( mosq, &mid, storage->topic, DEFAULT_QOS ); diff --git a/xwords4/relay/scripts/mqtt-showinplay.py b/xwords4/relay/scripts/mqtt-showinplay.py index 25ec50939..924ccf5c9 100755 --- a/xwords4/relay/scripts/mqtt-showinplay.py +++ b/xwords4/relay/scripts/mqtt-showinplay.py @@ -50,6 +50,7 @@ def main(): args = mkParser().parse_args() mqttc = makeClient() + mqttc.username_pw_set('xwuser', password='xw4r0cks') mqttc.connect(args.HOST, args.PORT) # Start subscribe, with QoS level 2 for topic in g_topics: