Changeset 3572

Show
Ignore:
Timestamp:
01/28/07 19:52:54 (2 years ago)
Author:
timothy
Message:

Update to the latest libtransmisson code for NAT traversal (r1444).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core/MVDirectClientConnection.m

    r3557 r3572  
    272272        if( success && [MVFileTransfer isAutoPortMappingEnabled] ) { 
    273273                tr_msgInit(); 
    274  
    275                 static tr_fd_t *fd = NULL; 
    276                 if( ! fd ) fd = tr_fdInit(); 
    277                 if( fd ) { 
    278                         _upnp = tr_upnpInit( fd ); 
    279                         tr_upnpStart( _upnp ); 
    280                         tr_upnpForwardPort( _upnp, port ); 
    281  
    282                         _natpmp = tr_natpmpInit( fd ); 
    283                         tr_natpmpStart( _natpmp ); 
    284                         tr_natpmpForwardPort( _natpmp, port ); 
    285  
    286                         NSDate *mappingStart = [NSDate date]; 
    287                         int status = 0; 
    288  
    289                         do { 
    290                                 tr_upnpPulse( _upnp ); 
    291                                 tr_natpmpPulse( _natpmp ); 
    292                                 status = natTraversalStatus( _upnp, _natpmp ); 
    293                         } while( ( status == 1 || status == 3 ) && ABS( [mappingStart timeIntervalSinceNow] ) < 5. );  
    294                 } 
     274                tr_fdInit(); 
     275 
     276                _upnp = tr_upnpInit(); 
     277                tr_upnpStart( _upnp ); 
     278                tr_upnpForwardPort( _upnp, port ); 
     279 
     280                _natpmp = tr_natpmpInit(); 
     281                tr_natpmpStart( _natpmp ); 
     282                tr_natpmpForwardPort( _natpmp, port ); 
     283 
     284                NSDate *mappingStart = [NSDate date]; 
     285                int status = 0; 
     286 
     287                do { 
     288                        tr_upnpPulse( _upnp ); 
     289                        tr_natpmpPulse( _natpmp ); 
     290                        status = natTraversalStatus( _upnp, _natpmp ); 
     291                } while( ( status == 1 || status == 3 ) && ABS( [mappingStart timeIntervalSinceNow] ) < 5. );  
    295292        } 
    296293 
  • trunk/Chat Core/Transmission.h

    r3505 r3572  
    2424void tr_setMessageLevel( int level ); 
    2525 
    26 typedef struct tr_fd_s tr_fd_t; 
    27  
    28 tr_fd_t *tr_fdInit( void ); 
     26void tr_fdInit( void ); 
    2927 
    3028typedef struct tr_natpmp_s tr_natpmp_t;  
    3129 
    32 tr_natpmp_t *tr_natpmpInit( tr_fd_t * ); 
     30tr_natpmp_t *tr_natpmpInit( void ); 
    3331void tr_natpmpStart( tr_natpmp_t * ); 
    3432void tr_natpmpStop( tr_natpmp_t * ); 
     
    4038typedef struct tr_upnp_s tr_upnp_t;  
    4139 
    42 tr_upnp_t *tr_upnpInit( tr_fd_t * ); 
     40tr_upnp_t *tr_upnpInit( void ); 
    4341void tr_upnpStart( tr_upnp_t * ); 
    4442void tr_upnpStop( tr_upnp_t * );