From 39b9c32fd7f54149d6b228ad2430b8c7f7e34fe6 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 9 Sep 2014 07:27:04 -0700 Subject: [PATCH] don't track and refuse to connect to deleted games: the tracking was incomplete (didn't persist) and gameIDs couldn't be reused. Fix later when it's not blocking development if the feature still makes sense. --- .../org/eehouse/android/xw4/BTService.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index aca26400e..ada720a5a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -1,4 +1,4 @@ -/* -*- compile-command: "find-and-ant.sh -i debug"; -*- */ +/* -*- compile-command: "find-and-ant.sh debug install"; -*- */ /* * Copyright 2010 - 2014 by Eric House (xwords@eehouse.org). All * rights reserved. @@ -439,6 +439,9 @@ public class BTService extends XWService { R.string.new_bt_body_fmt, sender ); postNotification( gameID, R.string.new_bt_title, body, rowid ); + // m_sender.allowReuse( gameID ); + + // Now: can/should I open the game??? } } else { result = BTCmd.INVITE_DUPID; @@ -467,7 +470,7 @@ public class BTService extends XWService { + "gameID of %d", len, host.getName(), gameID ); - // check if it's still here + // check if still here long[] rowids = DBUtils.getRowIDsFor( BTService.this, gameID ); boolean haveGame = null != rowids && 0 < rowids.length; @@ -576,13 +579,13 @@ public class BTService extends XWService { private class BTSenderThread extends Thread { private LinkedBlockingQueue m_queue; private HashMap > m_resends; - private HashSet m_deadGames; + // private HashSet m_deadGames; public BTSenderThread() { m_queue = new LinkedBlockingQueue(); m_resends = new HashMap >(); - m_deadGames = new HashSet(); + // m_deadGames = new HashSet(); } public void add( BTQueueElem elem ) @@ -592,9 +595,9 @@ public class BTService extends XWService { public void removeFor( int gameID ) { - synchronized( m_deadGames ) { - m_deadGames.add( gameID ); - } + // synchronized( m_deadGames ) { + // m_deadGames.add( gameID ); + // } } @Override @@ -727,15 +730,15 @@ public class BTService extends XWService { private boolean sendMsg( BTQueueElem elem ) { - boolean success; - synchronized( m_deadGames ) { - success = m_deadGames.contains( elem.m_gameID ); - } + boolean success = false; + // synchronized( m_deadGames ) { + // success = m_deadGames.contains( elem.m_gameID ); + // } MultiEvent evt; if ( success ) { evt = MultiEvent.MESSAGE_DROPPED; - DbgUtils.logf( "dropping message because game %X dead", - elem.m_gameID ); + DbgUtils.logf( "dropping message %s because game %X dead", + elem.m_cmd, elem.m_gameID ); } else { evt = MultiEvent.MESSAGE_REFUSED; }