mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
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:
parent
b12cf55a83
commit
2202639606
3 changed files with 2 additions and 31 deletions
|
@ -586,7 +586,7 @@ public class BTService extends XWService {
|
||||||
|
|
||||||
for ( long rowid : rowids ) {
|
for ( long rowid : rowids ) {
|
||||||
boolean consumed =
|
boolean consumed =
|
||||||
BoardDelegate.feedMessage( gameID, buffer, addr );
|
BoardDelegate.feedMessage( rowid, buffer, addr );
|
||||||
if ( !consumed && haveGame ) {
|
if ( !consumed && haveGame ) {
|
||||||
LastMoveInfo lmi = new LastMoveInfo();
|
LastMoveInfo lmi = new LastMoveInfo();
|
||||||
if ( GameUtils.feedMessage( BTService.this, rowid,
|
if ( GameUtils.feedMessage( BTService.this, rowid,
|
||||||
|
|
|
@ -144,35 +144,6 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
private static Set<BoardDelegate> s_this = new HashSet<BoardDelegate>();
|
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,
|
public static boolean feedMessage( long rowid, byte[] msg,
|
||||||
CommsAddrRec ret )
|
CommsAddrRec ret )
|
||||||
{
|
{
|
||||||
|
|
|
@ -654,7 +654,7 @@ public class SMSService extends XWService {
|
||||||
sendDiedPacket( addr.sms_phone, gameID );
|
sendDiedPacket( addr.sms_phone, gameID );
|
||||||
} else {
|
} else {
|
||||||
for ( long rowid : rowids ) {
|
for ( long rowid : rowids ) {
|
||||||
if ( BoardDelegate.feedMessage( gameID, msg, addr ) ) {
|
if ( BoardDelegate.feedMessage( rowid, msg, addr ) ) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
SMSMsgSink sink = new SMSMsgSink( this );
|
SMSMsgSink sink = new SMSMsgSink( this );
|
||||||
|
|
Loading…
Reference in a new issue