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.
This commit is contained in:
Eric House 2020-08-22 12:36:31 -07:00
parent f8f3082c0f
commit dc7064a168
4 changed files with 17 additions and 5 deletions

View file

@ -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;

View file

@ -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() );

View file

@ -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 );

View file

@ -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: