mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
remove timestamps from mqtt header and procs that feed it
It belongs in comms msg header. Also remove PROTO_2, which shipping code can read but never could send.
This commit is contained in:
parent
310e1cea4f
commit
837991feb4
9 changed files with 35 additions and 79 deletions
|
@ -126,7 +126,7 @@ public class CommsTransport implements TransportProcs {
|
||||||
nSent = NFCUtils.addMsgFor( buf, gameID );
|
nSent = NFCUtils.addMsgFor( buf, gameID );
|
||||||
break;
|
break;
|
||||||
case COMMS_CONN_MQTT:
|
case COMMS_CONN_MQTT:
|
||||||
nSent = MQTTUtils.send( context, addr.mqtt_devID, gameID, timestamp, buf );
|
nSent = MQTTUtils.send( context, addr.mqtt_devID, gameID, buf );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.failDbg();
|
Assert.failDbg();
|
||||||
|
|
|
@ -543,12 +543,12 @@ public class MQTTUtils extends Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendInvite( Context context, String invitee,
|
public static void sendInvite( Context context, String invitee,
|
||||||
int timestamp, NetLaunchInfo nli )
|
NetLaunchInfo nli )
|
||||||
{
|
{
|
||||||
Log.d( TAG, "sendInvite(invitee: %s, nli: %s)", invitee, nli );
|
Log.d( TAG, "sendInvite(invitee: %s, nli: %s)", invitee, nli );
|
||||||
byte[][][] packets = {null};
|
byte[][][] packets = {null};
|
||||||
String[][] topics = {null};
|
String[][] topics = {null};
|
||||||
XwJNI.dvc_makeMQTTInvites( invitee, timestamp, nli, topics, packets );
|
XwJNI.dvc_makeMQTTInvites( invitee, nli, topics, packets );
|
||||||
addToSendQueue( context, topics[0], packets[0] );
|
addToSendQueue( context, topics[0], packets[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,13 +570,13 @@ public class MQTTUtils extends Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int send( Context context, String addressee, int gameID,
|
public static int send( Context context, String addressee, int gameID,
|
||||||
int timestamp, byte[] buf )
|
byte[] buf )
|
||||||
{
|
{
|
||||||
Log.d( TAG, "send(to:%s, len: %d)", addressee, buf.length );
|
Log.d( TAG, "send(to:%s, len: %d)", addressee, buf.length );
|
||||||
Assert.assertTrueNR( 16 == addressee.length() );
|
Assert.assertTrueNR( 16 == addressee.length() );
|
||||||
String[][] topics = {null};
|
String[][] topics = {null};
|
||||||
byte[][][] packets = {null};
|
byte[][][] packets = {null};
|
||||||
XwJNI.dvc_makeMQTTMessages( addressee, gameID, timestamp, buf, topics, packets );
|
XwJNI.dvc_makeMQTTMessages( addressee, gameID, buf, topics, packets );
|
||||||
addToSendQueue( context, topics[0], packets[0] );
|
addToSendQueue( context, topics[0], packets[0] );
|
||||||
return buf.length;
|
return buf.length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ public class MultiMsgSink implements TransportProcs {
|
||||||
return NFCUtils.addMsgFor( buf, gameID );
|
return NFCUtils.addMsgFor( buf, gameID );
|
||||||
}
|
}
|
||||||
|
|
||||||
int sendViaMQTT( String addressee, byte[] buf, int gameID, int timestamp )
|
int sendViaMQTT( String addressee, byte[] buf, int gameID )
|
||||||
{
|
{
|
||||||
return MQTTUtils.send( m_context, addressee, gameID, timestamp, buf );
|
return MQTTUtils.send( m_context, addressee, gameID, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int numSent()
|
public int numSent()
|
||||||
|
@ -124,7 +124,7 @@ public class MultiMsgSink implements TransportProcs {
|
||||||
nSent = sendViaNFC( buf, gameID );
|
nSent = sendViaNFC( buf, gameID );
|
||||||
break;
|
break;
|
||||||
case COMMS_CONN_MQTT:
|
case COMMS_CONN_MQTT:
|
||||||
nSent = sendViaMQTT( addr.mqtt_devID, buf, gameID, timestamp );
|
nSent = sendViaMQTT( addr.mqtt_devID, buf, gameID );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.failDbg();
|
Assert.failDbg();
|
||||||
|
@ -161,7 +161,7 @@ public class MultiMsgSink implements TransportProcs {
|
||||||
case COMMS_CONN_MQTT:
|
case COMMS_CONN_MQTT:
|
||||||
target = addr.mqtt_devID;
|
target = addr.mqtt_devID;
|
||||||
means = InviteMeans.MQTT;
|
means = InviteMeans.MQTT;
|
||||||
MQTTUtils.sendInvite( context, addr.mqtt_devID, timestamp, nli );
|
MQTTUtils.sendInvite( context, addr.mqtt_devID, nli );
|
||||||
success = true;
|
success = true;
|
||||||
break;
|
break;
|
||||||
case COMMS_CONN_SMS:
|
case COMMS_CONN_SMS:
|
||||||
|
|
|
@ -153,20 +153,18 @@ public class XwJNI {
|
||||||
return dvc_getMQTTSubTopics( getJNI().m_ptrGlobals );
|
return dvc_getMQTTSubTopics( getJNI().m_ptrGlobals );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dvc_makeMQTTInvites( String invitee, int timestamp,
|
public static void dvc_makeMQTTInvites( String invitee, NetLaunchInfo nli,
|
||||||
NetLaunchInfo nli, String[][] topics,
|
String[][] topics, byte[][][] packets )
|
||||||
byte[][][] packets )
|
|
||||||
{
|
{
|
||||||
dvc_makeMQTTInvites( getJNI().m_ptrGlobals, invitee, timestamp,
|
dvc_makeMQTTInvites( getJNI().m_ptrGlobals, invitee,
|
||||||
nli, topics, packets );
|
nli, topics, packets );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dvc_makeMQTTMessages( String addressee, int gameID,
|
public static void dvc_makeMQTTMessages( String addressee, int gameID, byte[] buf,
|
||||||
int timestamp, byte[] buf,
|
|
||||||
String[][] topics, byte[][][] packets )
|
String[][] topics, byte[][][] packets )
|
||||||
{
|
{
|
||||||
dvc_makeMQTTMessages( getJNI().m_ptrGlobals, addressee, gameID,
|
dvc_makeMQTTMessages( getJNI().m_ptrGlobals, addressee, gameID,
|
||||||
timestamp, buf, topics, packets );
|
buf, topics, packets );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dvc_makeMQTTNoSuchGames( String addressee, int gameID,
|
public static void dvc_makeMQTTNoSuchGames( String addressee, int gameID,
|
||||||
|
@ -772,14 +770,12 @@ public class XwJNI {
|
||||||
private static native String[] dvc_getMQTTSubTopics( long jniState );
|
private static native String[] dvc_getMQTTSubTopics( long jniState );
|
||||||
private static native void dvc_makeMQTTInvites( long jniState,
|
private static native void dvc_makeMQTTInvites( long jniState,
|
||||||
String invitee,
|
String invitee,
|
||||||
int timestamp,
|
|
||||||
NetLaunchInfo nli,
|
NetLaunchInfo nli,
|
||||||
String[][] topics,
|
String[][] topics,
|
||||||
byte[][][] packets );
|
byte[][][] packets );
|
||||||
private static native void dvc_makeMQTTMessages( long jniState,
|
private static native void dvc_makeMQTTMessages( long jniState,
|
||||||
String addressee,
|
String addressee,
|
||||||
int gameID,
|
int gameID, byte[] buf,
|
||||||
int timestamp, byte[] buf,
|
|
||||||
String[][] topics,
|
String[][] topics,
|
||||||
byte[][][] packets );
|
byte[][][] packets );
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ LOCAL_DEFINES += \
|
||||||
-DMQTT_DEV_TOPICS \
|
-DMQTT_DEV_TOPICS \
|
||||||
-DMQTT_GAMEID_TOPICS \
|
-DMQTT_GAMEID_TOPICS \
|
||||||
|
|
||||||
# -DMQTT_USE_PROTO=2 \
|
|
||||||
|
|
||||||
# XWFEATURE_RAISETILE: first, fix to not use timer
|
# XWFEATURE_RAISETILE: first, fix to not use timer
|
||||||
# -DXWFEATURE_RAISETILE \
|
# -DXWFEATURE_RAISETILE \
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ wrapResults( jobjectArray jTopicsOut, jobjectArray jPacketsOut, MTPData* mtp )
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTInvites
|
Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTInvites
|
||||||
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jstring jAddressee,
|
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jstring jAddressee,
|
||||||
jint jTimestamp, jobject jnli, jobjectArray jTopicsOut,
|
jobject jnli, jobjectArray jTopicsOut,
|
||||||
jobjectArray jPacketsOut )
|
jobjectArray jPacketsOut )
|
||||||
{
|
{
|
||||||
DVC_HEADER(jniGlobalPtr);
|
DVC_HEADER(jniGlobalPtr);
|
||||||
|
@ -752,7 +752,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTInvites
|
||||||
jstrToDevID( env, jAddressee, &addressee );
|
jstrToDevID( env, jAddressee, &addressee );
|
||||||
|
|
||||||
dvc_makeMQTTInvites( globalState->dutil, env, msgAndTopicProc, &mtp,
|
dvc_makeMQTTInvites( globalState->dutil, env, msgAndTopicProc, &mtp,
|
||||||
&addressee, &nli, jTimestamp );
|
&addressee, &nli );
|
||||||
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
||||||
|
|
||||||
DVC_HEADER_END();
|
DVC_HEADER_END();
|
||||||
|
@ -761,7 +761,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTInvites
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTMessages
|
Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTMessages
|
||||||
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jstring jAddressee,
|
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jstring jAddressee,
|
||||||
jint jGameID, jint jTimestamp, jbyteArray jmsg,
|
jint jGameID, jbyteArray jmsg,
|
||||||
jobjectArray jTopicsOut, jobjectArray jPacketsOut )
|
jobjectArray jTopicsOut, jobjectArray jPacketsOut )
|
||||||
{
|
{
|
||||||
LOG_FUNC();
|
LOG_FUNC();
|
||||||
|
@ -778,8 +778,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTMessages
|
||||||
XP_U16 len = (*env)->GetArrayLength( env, jmsg );
|
XP_U16 len = (*env)->GetArrayLength( env, jmsg );
|
||||||
jbyte* buf = (*env)->GetByteArrayElements( env, jmsg, NULL );
|
jbyte* buf = (*env)->GetByteArrayElements( env, jmsg, NULL );
|
||||||
dvc_makeMQTTMessages( globalState->dutil, env, msgAndTopicProc, &mtp,
|
dvc_makeMQTTMessages( globalState->dutil, env, msgAndTopicProc, &mtp,
|
||||||
&addressee, jGameID, jTimestamp,
|
&addressee, jGameID, (const XP_U8*)buf, len );
|
||||||
(const XP_U8*)buf, len );
|
|
||||||
(*env)->ReleaseByteArrayElements( env, jmsg, buf, 0 );
|
(*env)->ReleaseByteArrayElements( env, jmsg, buf, 0 );
|
||||||
|
|
||||||
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
||||||
|
@ -800,7 +799,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dvc_1makeMQTTNoSuchGames
|
||||||
jstrToDevID( env, jAddressee, &addressee );
|
jstrToDevID( env, jAddressee, &addressee );
|
||||||
|
|
||||||
dvc_makeMQTTNoSuchGames( globalState->dutil, env, msgAndTopicProc, &mtp,
|
dvc_makeMQTTNoSuchGames( globalState->dutil, env, msgAndTopicProc, &mtp,
|
||||||
&addressee, jgameid, 0 );
|
&addressee, jgameid );
|
||||||
|
|
||||||
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
wrapResults( jTopicsOut, jPacketsOut, &mtp );
|
||||||
|
|
||||||
|
|
|
@ -241,15 +241,15 @@ typedef enum { CMD_INVITE, CMD_MSG, CMD_DEVGONE, } MQTTCmd;
|
||||||
|
|
||||||
// #define PROTO_0 0
|
// #define PROTO_0 0
|
||||||
#define PROTO_1 1 /* moves gameID into "header" relay2 knows about */
|
#define PROTO_1 1 /* moves gameID into "header" relay2 knows about */
|
||||||
#define PROTO_2 2 /* adds timestamp to header */
|
#define _PROTO_2 2 /* never used, and now deprecated (value 2 is) */
|
||||||
#define PROTO_3 3 /* adds multi-message, removes gameID */
|
#define PROTO_3 3 /* adds multi-message, removes gameID and timestamp */
|
||||||
#ifndef MQTT_USE_PROTO
|
#ifndef MQTT_USE_PROTO
|
||||||
# define MQTT_USE_PROTO PROTO_1
|
# define MQTT_USE_PROTO PROTO_1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addHeaderGameIDAndCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
addHeaderGameIDAndCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||||
XP_U32 gameID, XP_U32 timestamp, XWStreamCtxt* stream )
|
XP_U32 gameID, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
stream_putU8( stream, MQTT_USE_PROTO );
|
stream_putU8( stream, MQTT_USE_PROTO );
|
||||||
|
|
||||||
|
@ -259,10 +259,6 @@ addHeaderGameIDAndCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||||
stream_putBytes( stream, &myID, sizeof(myID) );
|
stream_putBytes( stream, &myID, sizeof(myID) );
|
||||||
|
|
||||||
stream_putU32( stream, gameID );
|
stream_putU32( stream, gameID );
|
||||||
if ( PROTO_2 <= MQTT_USE_PROTO ) {
|
|
||||||
XP_ASSERT(0 != timestamp);
|
|
||||||
stream_putU32( stream, timestamp );
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_putU8( stream, cmd );
|
stream_putU8( stream, cmd );
|
||||||
}
|
}
|
||||||
|
@ -270,9 +266,8 @@ addHeaderGameIDAndCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||||
#ifdef MQTT_GAMEID_TOPICS
|
#ifdef MQTT_GAMEID_TOPICS
|
||||||
static void
|
static void
|
||||||
addProto3HeaderCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
addProto3HeaderCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||||
XP_U32 timestamp, XWStreamCtxt* stream )
|
XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_ASSERT( 0 != timestamp );
|
|
||||||
stream_putU8( stream, PROTO_3 );
|
stream_putU8( stream, PROTO_3 );
|
||||||
|
|
||||||
MQTTDevID myID;
|
MQTTDevID myID;
|
||||||
|
@ -280,8 +275,6 @@ addProto3HeaderCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||||
myID = htobe64( myID );
|
myID = htobe64( myID );
|
||||||
stream_putBytes( stream, &myID, sizeof(myID) );
|
stream_putBytes( stream, &myID, sizeof(myID) );
|
||||||
|
|
||||||
stream_putU32( stream, timestamp );
|
|
||||||
|
|
||||||
stream_putU8( stream, cmd );
|
stream_putU8( stream, cmd );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -296,15 +289,13 @@ void
|
||||||
dvc_makeMQTTInvites( XW_DUtilCtxt* dutil, XWEnv xwe,
|
dvc_makeMQTTInvites( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
const NetLaunchInfo* nli,
|
const NetLaunchInfo* nli )
|
||||||
XP_U32 timestamp )
|
|
||||||
{
|
{
|
||||||
XP_UCHAR devTopic[64]; /* used by two below */
|
XP_UCHAR devTopic[64]; /* used by two below */
|
||||||
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
||||||
/* Stream format is identical for both topics */
|
/* Stream format is identical for both topics */
|
||||||
XWStreamCtxt* stream = mkStream( dutil );
|
XWStreamCtxt* stream = mkStream( dutil );
|
||||||
addHeaderGameIDAndCmd( dutil, xwe, CMD_INVITE, nli->gameID,
|
addHeaderGameIDAndCmd( dutil, xwe, CMD_INVITE, nli->gameID, stream );
|
||||||
timestamp, stream );
|
|
||||||
nli_saveToStream( nli, stream );
|
nli_saveToStream( nli, stream );
|
||||||
|
|
||||||
#ifdef MQTT_DEV_TOPICS
|
#ifdef MQTT_DEV_TOPICS
|
||||||
|
@ -330,8 +321,7 @@ void
|
||||||
dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
XP_U32 gameID, XP_U32 timestamp,
|
XP_U32 gameID, const XP_U8* buf, XP_U16 len )
|
||||||
const XP_U8* buf, XP_U16 len )
|
|
||||||
{
|
{
|
||||||
XP_UCHAR devTopic[64]; /* used by two below */
|
XP_UCHAR devTopic[64]; /* used by two below */
|
||||||
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
||||||
|
@ -339,10 +329,7 @@ dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
#ifdef MQTT_DEV_TOPICS
|
#ifdef MQTT_DEV_TOPICS
|
||||||
{
|
{
|
||||||
XWStreamCtxt* stream = mkStream( dutil );
|
XWStreamCtxt* stream = mkStream( dutil );
|
||||||
addHeaderGameIDAndCmd( dutil, xwe, CMD_MSG, gameID, timestamp, stream );
|
addHeaderGameIDAndCmd( dutil, xwe, CMD_MSG, gameID, stream );
|
||||||
if ( PROTO_2 <= MQTT_USE_PROTO ) {
|
|
||||||
stream_putU32VL( stream, len );
|
|
||||||
}
|
|
||||||
stream_putBytes( stream, buf, len );
|
stream_putBytes( stream, buf, len );
|
||||||
callProc( proc, closure, devTopic, stream );
|
callProc( proc, closure, devTopic, stream );
|
||||||
stream_destroy( stream, xwe );
|
stream_destroy( stream, xwe );
|
||||||
|
@ -352,7 +339,7 @@ dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
#ifdef MQTT_GAMEID_TOPICS
|
#ifdef MQTT_GAMEID_TOPICS
|
||||||
{
|
{
|
||||||
XWStreamCtxt* stream = mkStream( dutil );
|
XWStreamCtxt* stream = mkStream( dutil );
|
||||||
addProto3HeaderCmd( dutil, xwe, CMD_MSG, timestamp, stream );
|
addProto3HeaderCmd( dutil, xwe, CMD_MSG, stream );
|
||||||
|
|
||||||
/* For now, we ship one message per packet. But the receiving code
|
/* For now, we ship one message per packet. But the receiving code
|
||||||
should be ready */
|
should be ready */
|
||||||
|
@ -378,19 +365,13 @@ void
|
||||||
dvc_makeMQTTNoSuchGames( XW_DUtilCtxt* dutil, XWEnv xwe,
|
dvc_makeMQTTNoSuchGames( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
XP_U32 gameID, XP_U32 timestamp )
|
XP_U32 gameID )
|
||||||
{
|
{
|
||||||
XP_UCHAR devTopic[64]; /* used by two below */
|
XP_UCHAR devTopic[64]; /* used by two below */
|
||||||
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
||||||
|
|
||||||
if ( 0 == timestamp ) {
|
|
||||||
timestamp = dutil_getCurSeconds( dutil, xwe );
|
|
||||||
XP_LOGFF( "replacing timestamp of 0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
XWStreamCtxt* stream = mkStream( dutil );
|
XWStreamCtxt* stream = mkStream( dutil );
|
||||||
addHeaderGameIDAndCmd( dutil, xwe, CMD_DEVGONE, gameID,
|
addHeaderGameIDAndCmd( dutil, xwe, CMD_DEVGONE, gameID, stream );
|
||||||
timestamp, stream );
|
|
||||||
#ifdef MQTT_DEV_TOPICS
|
#ifdef MQTT_DEV_TOPICS
|
||||||
callProc( proc, closure, devTopic, stream );
|
callProc( proc, closure, devTopic, stream );
|
||||||
#endif
|
#endif
|
||||||
|
@ -474,7 +455,7 @@ dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic,
|
||||||
|
|
||||||
XP_U8 proto = 0;
|
XP_U8 proto = 0;
|
||||||
if ( stream_gotU8( stream, &proto )
|
if ( stream_gotU8( stream, &proto )
|
||||||
&& (proto == PROTO_1 || proto == PROTO_2 || proto == PROTO_3 ) ) {
|
&& (proto == PROTO_1 || proto == PROTO_3 ) ) {
|
||||||
MQTTDevID senderID;
|
MQTTDevID senderID;
|
||||||
stream_getBytes( stream, &senderID, sizeof(senderID) );
|
stream_getBytes( stream, &senderID, sizeof(senderID) );
|
||||||
senderID = be64toh( senderID );
|
senderID = be64toh( senderID );
|
||||||
|
@ -489,18 +470,6 @@ dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic,
|
||||||
XP_ASSERT( 0 != gameID );
|
XP_ASSERT( 0 != gameID );
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_U32 timestamp = 0;
|
|
||||||
if ( PROTO_2 <= proto ) {
|
|
||||||
timestamp = stream_getU32( stream );
|
|
||||||
#ifdef DEBUG
|
|
||||||
if ( 0 < timestamp ) {
|
|
||||||
XP_U32 now = dutil_getCurSeconds( dutil, xwe );
|
|
||||||
XP_LOGFF( "delivery took %ds", now - timestamp );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
XP_USE( timestamp );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
MQTTCmd cmd = stream_getU8( stream );
|
MQTTCmd cmd = stream_getU8( stream );
|
||||||
|
|
||||||
/* Need to ack even if discarded/malformed */
|
/* Need to ack even if discarded/malformed */
|
||||||
|
|
|
@ -41,18 +41,16 @@ void dvc_getMQTTSubTopics( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
void dvc_makeMQTTInvites( XW_DUtilCtxt* dutil, XWEnv xwe,
|
void dvc_makeMQTTInvites( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
const NetLaunchInfo* nli,
|
const NetLaunchInfo* nli );
|
||||||
XP_U32 timestamp );
|
|
||||||
|
|
||||||
void dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
void dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
XP_U32 gameID, XP_U32 timestamp,
|
XP_U32 gameID, const XP_U8* buf, XP_U16 len );
|
||||||
const XP_U8* buf, XP_U16 len );
|
|
||||||
void dvc_makeMQTTNoSuchGames( XW_DUtilCtxt* dutil, XWEnv xwe,
|
void dvc_makeMQTTNoSuchGames( XW_DUtilCtxt* dutil, XWEnv xwe,
|
||||||
MsgAndTopicProc proc, void* closure,
|
MsgAndTopicProc proc, void* closure,
|
||||||
const MQTTDevID* addressee,
|
const MQTTDevID* addressee,
|
||||||
XP_U32 gameID, XP_U32 timestamp );
|
XP_U32 gameID );
|
||||||
void dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic,
|
void dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic,
|
||||||
const XP_U8* buf, XP_U16 len );
|
const XP_U8* buf, XP_U16 len );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -272,10 +272,6 @@ LIBS += `pkg-config --libs glib-2.0`
|
||||||
CFLAGS += $(POINTER_SUPPORT)
|
CFLAGS += $(POINTER_SUPPORT)
|
||||||
CFLAGS += -DDROP_BITMAPS
|
CFLAGS += -DDROP_BITMAPS
|
||||||
|
|
||||||
# Turn on for testing. Eventually, just turn on, but sends to old
|
|
||||||
# builds will then fail
|
|
||||||
# CFLAGS += -DMQTT_USE_PROTO=2
|
|
||||||
|
|
||||||
ifneq (,$(findstring DPLATFORM_NCURSES,$(DEFINES)))
|
ifneq (,$(findstring DPLATFORM_NCURSES,$(DEFINES)))
|
||||||
LIBS += $(OE_LIBDIR) -lncursesw
|
LIBS += $(OE_LIBDIR) -lncursesw
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue