Add assert; don't call comms if has been set to null (fixes device

reset); fix failure to install connCB (removes need to manually resend
messages when client starts up first.)
This commit is contained in:
ehouse 2007-02-04 17:13:01 +00:00
parent aac30fffea
commit 6af89b4182
3 changed files with 8 additions and 3 deletions

View file

@ -1292,6 +1292,7 @@ relayConnect( CommsCtxt* comms )
static void
btConnect( CommsCtxt* comms )
{
XP_ASSERT( !!comms );
/* Ping the bt layer so it'll get sockets set up. PENDING: if I'm server
need to do this once per guest record with non-null address. Might as
well use real messages if we have 'em. Otherwise a fake size-0 msg. */

View file

@ -49,7 +49,7 @@ typedef enum {
, PBTST_L2C_CONNECTED /* slave */
} PBT_STATE;
#define PBT_MAX_ACTS 4
#define PBT_MAX_ACTS 6 /* four wasn't enough */
#define HASWORK(s) ((s)->queueCur != (s)->queueNext)
#define MAX_PACKETS 4
@ -424,10 +424,10 @@ palm_bt_send( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
if ( !!btStuff ) {
if ( !btStuff->dataCb ) {
btStuff->dataCb = dataCb;
btStuff->connCb = connCb;
} else {
XP_ASSERT( dataCb == btStuff->dataCb );
}
btStuff->connCb = connCb;
if ( !addr ) {
comms_getAddr( globals->game.comms, &remoteAddr );
@ -604,6 +604,8 @@ pbt_do_work( PalmBTStuff* btStuff )
case PBT_ACT_TELLCONN:
if ( !!btStuff->connCb ) {
(*btStuff->connCb)( btStuff->globals );
} else {
XP_LOGF( "no callback" );
}
break;

View file

@ -3864,7 +3864,9 @@ btDataHandler( PalmAppGlobals* globals, const CommsAddrRec* fromAddr,
static void
btConnHandler( PalmAppGlobals* globals )
{
comms_resendAll( globals->game.comms );
if ( !!globals->game.comms ) {
comms_resendAll( globals->game.comms );
}
} /* btConnHandler */
#endif