feed messages by rowid, not gameID, in case a device has more than one

participant. This is toward fixing SMS same-device games (useful for
testing only, but VERY useful for that.)
This commit is contained in:
Eric House 2015-02-07 13:11:52 -08:00
parent b12cf55a83
commit 2202639606
3 changed files with 2 additions and 31 deletions

View file

@ -586,7 +586,7 @@ public class BTService extends XWService {
for ( long rowid : rowids ) {
boolean consumed =
BoardDelegate.feedMessage( gameID, buffer, addr );
BoardDelegate.feedMessage( rowid, buffer, addr );
if ( !consumed && haveGame ) {
LastMoveInfo lmi = new LastMoveInfo();
if ( GameUtils.feedMessage( BTService.this, rowid,

View file

@ -144,35 +144,6 @@ public class BoardDelegate extends DelegateBase
private static Set<BoardDelegate> s_this = new HashSet<BoardDelegate>();
public static boolean feedMessage( int gameID, byte[] msg,
CommsAddrRec retAddr )
{
boolean delivered = false;
int size;
synchronized( s_this ) {
size = s_this.size();
if ( 1 == size ) {
BoardDelegate self = s_this.iterator().next();
Assert.assertNotNull( self.m_gi );
Assert.assertNotNull( self.m_gameLock );
if ( gameID == self.m_gi.gameID ) {
if ( null != self.m_jniThread ) {
self.m_jniThread.handle( JNICmd.CMD_RECEIVE, msg, retAddr );
delivered = true;
} else {
DbgUtils.logf( "BoardDelegate.feedMessage(): race condition lost; "
+ "dropping message" );
}
}
}
}
if ( 1 < s_this.size() ) {
noteSkip();
}
return delivered;
}
public static boolean feedMessage( long rowid, byte[] msg,
CommsAddrRec ret )
{

View file

@ -654,7 +654,7 @@ public class SMSService extends XWService {
sendDiedPacket( addr.sms_phone, gameID );
} else {
for ( long rowid : rowids ) {
if ( BoardDelegate.feedMessage( gameID, msg, addr ) ) {
if ( BoardDelegate.feedMessage( rowid, msg, addr ) ) {
// do nothing
} else {
SMSMsgSink sink = new SMSMsgSink( this );