Ignore:
Timestamp:
Apr 23, 2010, 11:45:44 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2842 "Transmission crashes randomly on ARM-based Synology NAS" -- experimental commit based on giovannibajo's suggestion in comment:39 about the list struct's alignment

File:
1 edited

Legend:

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

    r10509 r10524  
    7676    tr_bool  isPieceData;
    7777    size_t   length;
    78     struct __tr_list head;
    7978};
    8079
     
    8887     while( bytes_transferred && tr_isPeerIo( io ) )
    8988     {
    90         struct tr_datatype * next = __tr_list_entry( io->outbuf_datatypes.next, struct tr_datatype, head );
     89        struct tr_datatype * next = io->outbuf_datatypes->data;
     90
    9191        const size_t payload = MIN( next->length, bytes_transferred );
    9292        const size_t overhead = guessPacketOverhead( payload );
     
    105105            next->length -= payload;
    106106            if( !next->length ) {
    107                 __tr_list_remove( io->outbuf_datatypes.next );
     107                tr_list_pop_front( &io->outbuf_datatypes );
    108108                tr_free( next );
    109109            }
     
    414414    event_set( &io->event_write, io->socket, EV_WRITE, event_write_cb, io );
    415415
    416     __tr_list_init( &io->outbuf_datatypes );
    417 
    418416    return io;
    419417}
     
    464462    assert( io->session != NULL );
    465463    assert( io->session->events != NULL );
     464    assert( io->socket >= 0 );
    466465    assert( event_initialized( &io->event_read ) );
    467466    assert( event_initialized( &io->event_write ) );
     
    527526****
    528527***/
    529 
    530 static void
    531 trDatatypeFree( void * data )
    532 {
    533     struct tr_datatype * dt = __tr_list_entry( data, struct tr_datatype, head );
    534     tr_free(dt);
    535 }
    536528
    537529static void
     
    551543    tr_netClose( io->session, io->socket );
    552544    tr_cryptoFree( io->crypto );
    553     __tr_list_destroy( &io->outbuf_datatypes, trDatatypeFree );
     545    tr_list_free( &io->outbuf_datatypes, tr_free );
    554546
    555547    memset( io, ~0, sizeof( tr_peerIo ) );
     
    817809    datatype->isPieceData = isPieceData != 0;
    818810    datatype->length = byteCount;
    819 
    820     __tr_list_init( &datatype->head );
    821     __tr_list_append( &io->outbuf_datatypes, &datatype->head );
     811    tr_list_append( &io->outbuf_datatypes, datatype );
    822812
    823813    switch( io->encryptionMode )
     
    998988{
    999989    size_t byteCount = 0;
    1000     struct __tr_list * walk;
    1001     struct __tr_list * fencepost = &io->outbuf_datatypes;
     990    tr_list * it;
    1002991
    1003992    /* count up how many bytes are used by non-piece-data messages
    1004993       at the front of our outbound queue */
    1005     for( walk=fencepost->next; walk!=fencepost; walk=walk->next ) {
    1006         struct tr_datatype * d = __tr_list_entry( walk, struct tr_datatype, head );
     994    for( it=io->outbuf_datatypes; it!=NULL; it=it->next )
     995    {
     996        struct tr_datatype * d = it->data;
     997
    1007998        if( d->isPieceData )
    1008999            break;
     1000
    10091001        byteCount += d->length;
    10101002    }
Note: See TracChangeset for help on using the changeset viewer.