separate internalization of comms from call to connect to relay since

the first must finish before the caller will have a valid reference to
comms.  call util_addrChange.
This commit is contained in:
ehouse 2005-04-03 17:00:59 +00:00
parent 0629dc5223
commit 31e1a46087
2 changed files with 12 additions and 5 deletions

View file

@ -317,12 +317,18 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util,
XP_ASSERT( stream_getU32( stream ) == cEND );
#endif
comms->relayState = COMMS_RELAYSTATE_UNCONNECTED;
comms_relayConnect( comms );
return comms;
} /* comms_makeFromStream */
void
comms_init( CommsCtxt* comms )
{
if ( comms->addr.conType == COMMS_CONN_RELAY ) {
comms->relayState = COMMS_RELAYSTATE_UNCONNECTED;
comms_relayConnect( comms );
}
}
static void
addrToStream( XWStreamCtxt* stream, CommsAddrRec* addrP )
{
@ -434,10 +440,10 @@ comms_getInitialAddr( CommsAddrRec* addr )
void
comms_setAddr( CommsCtxt* comms, CommsAddrRec* addr )
{
XP_MEMCPY( &comms->addr, addr, sizeof(comms->addr) );
#ifdef BEYOND_IR
/* util_listenPortChange( comms->util, listenPort ); */
util_addrChange( comms->util, &comms->addr, addr );
#endif
XP_MEMCPY( &comms->addr, addr, sizeof(comms->addr) );
/* We should now have a cookie so we can connect??? */
comms_relayConnect( comms );

View file

@ -92,6 +92,7 @@ CommsConnType comms_getConType( CommsCtxt* comms );
CommsCtxt* comms_makeFromStream( MPFORMAL XWStreamCtxt* stream,
XW_UtilCtxt* util, TransportSend sendproc,
void* closure );
void comms_init( CommsCtxt* comms );
void comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream );
XP_S16 comms_send( CommsCtxt* comms, XWStreamCtxt* stream );