fix failure to connect using means (e.g. BT) that becomes available

partway through a game. Problem was that once a channel was working
with one means we wouldn't fall back to default addressing for the
means for which we didn't have a return address yet. (NOTE: Not yet
fully tested...)
This commit is contained in:
Eric House 2015-06-11 07:29:47 -07:00
parent b000564278
commit 2e8c7695f3

View file

@ -1392,23 +1392,20 @@ sendMsg( CommsCtxt* comms, MsgQueueElem* elem )
const CommsAddrRec* addrP; const CommsAddrRec* addrP;
(void)channelToAddress( comms, channelNo, &addrP ); (void)channelToAddress( comms, channelNo, &addrP );
if ( NULL == addrP ) { if ( NULL == addrP || !addr_hasType( addrP, typ ) ) {
XP_LOGF( TAGFMT() "no addr for channel so using comms'", TAGPRMS ); XP_LOGF( TAGFMT() "no addr for channel or addr type %s"
" so using comms'", ConnType2Str(typ), TAGPRMS );
comms_getAddr( comms, &addr ); comms_getAddr( comms, &addr );
} else { } else {
addr = *addrP; addr = *addrP;
} }
XP_ASSERT( addr_hasType( &addr, typ ) );
XP_ASSERT( !!comms->procs.send ); XP_ASSERT( !!comms->procs.send );
if ( addr_hasType( &addr, typ ) ) {
XP_U32 gameid = gameID( comms ); XP_U32 gameid = gameID( comms );
logAddr( comms, &addr, __func__ ); logAddr( comms, &addr, __func__ );
nSent = (*comms->procs.send)( elem->msg, elem->len, &addr, typ, nSent = (*comms->procs.send)( elem->msg, elem->len, &addr, typ,
gameid, comms->procs.closure ); gameid, comms->procs.closure );
} else {
XP_LOGF( TAGFMT() "not sending b/c type %s missing from addr",
TAGPRMS, ConnType2Str(typ) );
}
break; break;
} }
} /* switch */ } /* switch */