Changeset 7803


Ignore:
Timestamp:
Jan 26, 2009, 2:51:50 AM (12 years ago)
Author:
charles
Message:

(trunk libT) add more assertions to make Biiaru crash moreHHHHHHHHHHHHHHHHhelp track down the cause of Biiaru's crashes

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-io.c

    r7793 r7803  
    421421{
    422422    tr_peerIo * io = vio;
    423     assert( tr_isPeerIo( io ) );
     423
     424    assert( tr_isPeerIo( io ) );
     425    assert( tr_amInEventThread( io->session ) );
     426    assert( io->session->events != NULL );
    424427
    425428    dbgmsg( io, "in tr_peerIo destructor" );
     
    845848event_enable( tr_peerIo * io, short event )
    846849{
     850    assert( tr_amInEventThread( io->session ) );
     851    assert( io->session->events != NULL );
    847852    assert( event_initialized( &io->event_read ) );
    848853    assert( event_initialized( &io->event_write ) );
     
    866871event_disable( struct tr_peerIo * io, short event )
    867872{
     873    assert( tr_amInEventThread( io->session ) );
     874    assert( io->session->events != NULL );
    868875    assert( event_initialized( &io->event_read ) );
    869876    assert( event_initialized( &io->event_write ) );
     
    894901    assert( tr_isPeerIo( io ) );
    895902    assert( tr_isDirection( dir ) );
     903    assert( tr_amInEventThread( io->session ) );
     904    assert( io->session->events != NULL );
    896905
    897906    if( isEnabled )
  • trunk/libtransmission/session.c

    r7720 r7803  
    456456
    457457    tr_netInit( ); /* must go before tr_eventInit */
    458 
    459458    tr_eventInit( session );
    460     while( !session->events )
    461         tr_wait( 50 );
     459    assert( session->events != NULL );
    462460
    463461    session->peerMgr = tr_peerMgrNew( session );
  • trunk/libtransmission/trevent.c

    r7658 r7803  
    233233{
    234234    tr_event_handle * eh = veh;
    235 
    236235    tr_dbg( "Starting libevent thread" );
    237236
     
    241240#endif
    242241
     242    eh->base = event_init( );
    243243    eh->session->events = eh;
    244244
    245245    /* listen to the pipe's read fd */
    246     event_set( &eh->pipeEvent, eh->fds[0], EV_READ | EV_PERSIST,
    247                readFromPipe,
    248                veh );
     246    event_set( &eh->pipeEvent, eh->fds[0], EV_READ | EV_PERSIST, readFromPipe, veh );
    249247    event_add( &eh->pipeEvent, NULL );
    250248    event_set_log_callback( logFunc );
     249
     250    /* loop until all the events are done */
    251251    event_dispatch( );
    252252
     253    /* shut down the thread */
    253254    tr_lockFree( eh->lock );
    254255    event_base_free( eh->base );
     
    263264    tr_event_handle * eh;
    264265
     266    session->events = NULL;
     267
    265268    eh = tr_new0( tr_event_handle, 1 );
    266269    eh->lock = tr_lockNew( );
    267270    pipe( eh->fds );
    268271    eh->session = session;
    269     eh->base = event_init( );
    270272    eh->thread = tr_threadNew( libeventThreadFunc, eh );
     273
     274    /* wait until the libevent thread is running */
     275    while( session->events == NULL )
     276        tr_wait( 100 );
    271277}
    272278
Note: See TracChangeset for help on using the changeset viewer.