use comms_setAddr rather than modifying const to set resolved address.

This commit is contained in:
ehouse 2005-09-04 20:34:52 +00:00
parent c319711cb1
commit 685adf53ad
2 changed files with 8 additions and 6 deletions

View file

@ -179,6 +179,8 @@ resolveAddressIfNot( PalmAppGlobals* globals, CommsAddrRec* addr,
*resolvedP = resolved = XP_TRUE; *resolvedP = resolved = XP_TRUE;
globals->nlStuff.ipAddrInval = XP_FALSE; globals->nlStuff.ipAddrInval = XP_FALSE;
comms_setAddr( globals->game.comms, addr );
} }
} }
return resolved; return resolved;
@ -235,22 +237,22 @@ sendLoop( PalmAppGlobals* globals, XP_U8* buf, XP_U16 len )
} /* sendLoop */ } /* sendLoop */
XP_S16 XP_S16
palm_ip_send( XP_U8* buf, XP_U16 len, CommsAddrRec* addr, palm_ip_send( XP_U8* buf, XP_U16 len, const CommsAddrRec* addrp,
PalmAppGlobals* globals ) PalmAppGlobals* globals )
{ {
CommsAddrRec localRec; CommsAddrRec localRec;
CommsAddrRec* addr = &localRec;
XP_S16 nSent = 0; XP_S16 nSent = 0;
XP_Bool resolved = XP_FALSE; XP_Bool resolved = XP_FALSE;
XP_LOGF( "palm_ip_send: len=%d", len ); XP_LOGF( "palm_ip_send: len=%d", len );
XP_ASSERT( len < MAX_MSG_LEN ); XP_ASSERT( len < MAX_MSG_LEN );
if ( !!addr ) { if ( !!addrp ) {
XP_MEMCPY( &localRec, addr, sizeof(localRec) ); XP_MEMCPY( addr, addrp, sizeof(*addr) );
} else { } else {
comms_getAddr( globals->game.comms, &localRec ); comms_getAddr( globals->game.comms, addr );
} }
addr = &localRec;
if ( openNetLibIfNot( globals ) ) { if ( openNetLibIfNot( globals ) ) {
if ( resolveAddressIfNot( globals, addr, &resolved ) ) { if ( resolveAddressIfNot( globals, addr, &resolved ) ) {

View file

@ -24,7 +24,7 @@
void palm_ip_setup( PalmAppGlobals* globals ); void palm_ip_setup( PalmAppGlobals* globals );
void palm_ip_close( PalmAppGlobals* globals ); void palm_ip_close( PalmAppGlobals* globals );
XP_S16 palm_ip_send( XP_U8* buf, XP_U16 len, CommsAddrRec* addr, XP_S16 palm_ip_send( XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
PalmAppGlobals* globals ); PalmAppGlobals* globals );
void ip_addr_change( PalmAppGlobals* globals, const CommsAddrRec* oldAddr, void ip_addr_change( PalmAppGlobals* globals, const CommsAddrRec* oldAddr,
const CommsAddrRec* newAddr ); const CommsAddrRec* newAddr );