mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
require that timestamp be set
MQTT must create the same header for each message, so having it set the current timestamp is bad. I actually think it belongs in the comms header, not in each transport.
This commit is contained in:
parent
2942c140ee
commit
bba8e99098
1 changed files with 2 additions and 9 deletions
|
@ -260,22 +260,19 @@ addHeaderGameIDAndCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
|||
|
||||
stream_putU32( stream, gameID );
|
||||
if ( PROTO_2 <= MQTT_USE_PROTO ) {
|
||||
if ( 0 == timestamp ) {
|
||||
timestamp = dutil_getCurSeconds( dutil, xwe );
|
||||
XP_LOGFF( "replacing timestamp of 0" );
|
||||
}
|
||||
XP_ASSERT(0 != timestamp);
|
||||
stream_putU32( stream, timestamp );
|
||||
}
|
||||
|
||||
stream_putU8( stream, cmd );
|
||||
}
|
||||
|
||||
|
||||
#ifdef MQTT_GAMEID_TOPICS
|
||||
static void
|
||||
addProto3HeaderCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
||||
XP_U32 timestamp, XWStreamCtxt* stream )
|
||||
{
|
||||
XP_ASSERT( 0 != timestamp );
|
||||
stream_putU8( stream, PROTO_3 );
|
||||
|
||||
MQTTDevID myID;
|
||||
|
@ -283,10 +280,6 @@ addProto3HeaderCmd( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTCmd cmd,
|
|||
myID = htobe64( myID );
|
||||
stream_putBytes( stream, &myID, sizeof(myID) );
|
||||
|
||||
if ( 0 == timestamp ) {
|
||||
timestamp = dutil_getCurSeconds( dutil, xwe );
|
||||
XP_LOGFF( "replacing timestamp of 0" );
|
||||
}
|
||||
stream_putU32( stream, timestamp );
|
||||
|
||||
stream_putU8( stream, cmd );
|
||||
|
|
Loading…
Reference in a new issue