mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
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:
parent
0629dc5223
commit
31e1a46087
2 changed files with 12 additions and 5 deletions
|
@ -317,12 +317,18 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util,
|
||||||
XP_ASSERT( stream_getU32( stream ) == cEND );
|
XP_ASSERT( stream_getU32( stream ) == cEND );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
comms->relayState = COMMS_RELAYSTATE_UNCONNECTED;
|
|
||||||
comms_relayConnect( comms );
|
|
||||||
|
|
||||||
return comms;
|
return comms;
|
||||||
} /* comms_makeFromStream */
|
} /* comms_makeFromStream */
|
||||||
|
|
||||||
|
void
|
||||||
|
comms_init( CommsCtxt* comms )
|
||||||
|
{
|
||||||
|
if ( comms->addr.conType == COMMS_CONN_RELAY ) {
|
||||||
|
comms->relayState = COMMS_RELAYSTATE_UNCONNECTED;
|
||||||
|
comms_relayConnect( comms );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addrToStream( XWStreamCtxt* stream, CommsAddrRec* addrP )
|
addrToStream( XWStreamCtxt* stream, CommsAddrRec* addrP )
|
||||||
{
|
{
|
||||||
|
@ -434,10 +440,10 @@ comms_getInitialAddr( CommsAddrRec* addr )
|
||||||
void
|
void
|
||||||
comms_setAddr( CommsCtxt* comms, CommsAddrRec* addr )
|
comms_setAddr( CommsCtxt* comms, CommsAddrRec* addr )
|
||||||
{
|
{
|
||||||
XP_MEMCPY( &comms->addr, addr, sizeof(comms->addr) );
|
|
||||||
#ifdef BEYOND_IR
|
#ifdef BEYOND_IR
|
||||||
/* util_listenPortChange( comms->util, listenPort ); */
|
util_addrChange( comms->util, &comms->addr, addr );
|
||||||
#endif
|
#endif
|
||||||
|
XP_MEMCPY( &comms->addr, addr, sizeof(comms->addr) );
|
||||||
|
|
||||||
/* We should now have a cookie so we can connect??? */
|
/* We should now have a cookie so we can connect??? */
|
||||||
comms_relayConnect( comms );
|
comms_relayConnect( comms );
|
||||||
|
|
|
@ -92,6 +92,7 @@ CommsConnType comms_getConType( CommsCtxt* comms );
|
||||||
CommsCtxt* comms_makeFromStream( MPFORMAL XWStreamCtxt* stream,
|
CommsCtxt* comms_makeFromStream( MPFORMAL XWStreamCtxt* stream,
|
||||||
XW_UtilCtxt* util, TransportSend sendproc,
|
XW_UtilCtxt* util, TransportSend sendproc,
|
||||||
void* closure );
|
void* closure );
|
||||||
|
void comms_init( CommsCtxt* comms );
|
||||||
void comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream );
|
void comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream );
|
||||||
|
|
||||||
XP_S16 comms_send( CommsCtxt* comms, XWStreamCtxt* stream );
|
XP_S16 comms_send( CommsCtxt* comms, XWStreamCtxt* stream );
|
||||||
|
|
Loading…
Reference in a new issue