Ignore:
Timestamp:
Sep 21, 2007, 5:31:29 AM (15 years ago)
Author:
charles
Message:

slightly less broken handling of cases where we can't bind to our listening port.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/shared.c

    r3105 r3119  
    146146
    147147    /* Create the new one */
     148    s->bindSocket = tr_netBindTCP( port );
     149
     150    /* Notify the trackers */
     151    SetPublicPort( s, port );
     152
    148153    /* XXX should handle failure here in a better way */
    149     s->bindSocket = tr_netBindTCP( port );
    150     if( 0 > s->bindSocket )
    151     {
    152         /* Notify the trackers */
    153         SetPublicPort( s, 0 );
     154    if( s->bindSocket < 0 )
     155    {
    154156        /* Remove the forwarding for the old port */
    155157        tr_natpmpRemoveForwarding( s->natpmp );
     
    160162        tr_inf( "Bound listening port %d", port );
    161163        listen( s->bindSocket, 5 );
    162         if( port != s->publicPort )
    163         {
    164             /* Notify the trackers */
    165             SetPublicPort( s, port );
    166         }
    167164        /* Forward the new port */
    168165        tr_natpmpForwardPort( s->natpmp, port );
     
    175172int tr_sharedGetPublicPort( tr_shared * s )
    176173{
     174fprintf( stderr, "%s:%d tr_sharedGetPublicPort returning %d\n", __FILE__, __LINE__, (int)s->publicPort );
    177175    return s->publicPort;
    178176}
     
    269267
    270268    for( tor = h->torrentList; tor; tor = tor->next )
    271         tr_torrentChangeMyPort( tor, port );
     269        tr_torrentChangeMyPort( tor );
    272270}
    273271
Note: See TracChangeset for help on using the changeset viewer.