when preprocessing a message, limit search to the address type of the

channel it came in on if known.
This commit is contained in:
Eric House 2014-11-02 17:24:37 -08:00
parent f853aad904
commit e1a10508e1
2 changed files with 11 additions and 5 deletions

View file

@ -537,7 +537,7 @@ addrFromStreamOne( CommsAddrRec* addrP, XWStreamCtxt* stream, CommsConnType typ
}
} /* addrFromStreamOne */
static void
void
addrFromStream( CommsAddrRec* addrP, XWStreamCtxt* stream )
{
XP_U8 tmp = stream_getU8( stream );
@ -756,7 +756,7 @@ addrToStreamOne( XWStreamCtxt* stream, CommsConnType typ, const CommsAddrRec* ad
}
} /* addrToStreamOne */
static void
void
addrToStream( XWStreamCtxt* stream, const CommsAddrRec* addrP )
{
stream_putU8( stream, addrP->_conTypes );
@ -1693,13 +1693,15 @@ btIpPreProcess( CommsCtxt* comms, XWStreamCtxt* stream )
#endif
static XP_Bool
preProcess( CommsCtxt* comms, XWStreamCtxt* stream,
preProcess( CommsCtxt* comms, const CommsAddrRec* useAddr,
XWStreamCtxt* stream,
XP_Bool* XP_UNUSED_RELAY(usingRelay),
XWHostID* XP_UNUSED_RELAY(senderID) )
{
XP_Bool consumed = XP_FALSE;
CommsConnType typ;
for ( XP_U32 st = 0; addr_iter( &comms->addr, &typ, &st ); ) {
for ( XP_U32 st = 0; addr_iter( useAddr, &typ, &st ); ) {
XP_LOGF( "%s(typ=%s)", __func__, ConnType2Str(typ) );
switch ( typ ) {
#ifdef XWFEATURE_RELAY
/* relayPreProcess returns true if consumes the message. May just eat the
@ -1925,7 +1927,8 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
XP_U16 initialLen = stream_getSize( stream );
#endif
if ( !preProcess( comms, stream, &usingRelay, &senderID ) ) {
const CommsAddrRec* useAddr = !!retAddr ? retAddr : &comms->addr;
if ( !preProcess( comms, useAddr, stream, &usingRelay, &senderID ) ) {
XP_U32 connID;
XP_PlayerAddr channelNo;
MsgID msgID;

View file

@ -208,6 +208,9 @@ void comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream,
XP_U16 saveToken );
void comms_saveSucceeded( CommsCtxt* comms, XP_U16 saveToken );
void addrFromStream( CommsAddrRec* addr, XWStreamCtxt* stream );
void addrToStream( XWStreamCtxt* stream, const CommsAddrRec* addr );
XP_S16 comms_send( CommsCtxt* comms, XWStreamCtxt* stream );
XP_Bool comms_resendAll( CommsCtxt* comms, XP_Bool force );
XP_U16 comms_getChannelSeed( CommsCtxt* comms );