Changeset 3119
- Timestamp:
- Sep 21, 2007, 5:31:29 AM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/internal.h
r3105 r3119 61 61 void tr_torrentUnlock ( const tr_torrent * ); 62 62 63 void tr_torrentChangeMyPort ( tr_torrent * , int port);63 void tr_torrentChangeMyPort ( tr_torrent * ); 64 64 65 65 int tr_torrentExists( tr_handle *, const uint8_t * ); … … 121 121 122 122 uint8_t * azId; 123 int publicPort;124 123 125 124 /* Where to download */ -
trunk/libtransmission/shared.c
r3105 r3119 146 146 147 147 /* Create the new one */ 148 s->bindSocket = tr_netBindTCP( port ); 149 150 /* Notify the trackers */ 151 SetPublicPort( s, port ); 152 148 153 /* 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 { 154 156 /* Remove the forwarding for the old port */ 155 157 tr_natpmpRemoveForwarding( s->natpmp ); … … 160 162 tr_inf( "Bound listening port %d", port ); 161 163 listen( s->bindSocket, 5 ); 162 if( port != s->publicPort )163 {164 /* Notify the trackers */165 SetPublicPort( s, port );166 }167 164 /* Forward the new port */ 168 165 tr_natpmpForwardPort( s->natpmp, port ); … … 175 172 int tr_sharedGetPublicPort( tr_shared * s ) 176 173 { 174 fprintf( stderr, "%s:%d tr_sharedGetPublicPort returning %d\n", __FILE__, __LINE__, (int)s->publicPort ); 177 175 return s->publicPort; 178 176 } … … 269 267 270 268 for( tor = h->torrentList; tor; tor = tor->next ) 271 tr_torrentChangeMyPort( tor , port);269 tr_torrentChangeMyPort( tor ); 272 270 } 273 271 -
trunk/libtransmission/torrent.c
r3111 r3119 360 360 NULL ); 361 361 362 /* We have a new torrent */363 tor->publicPort = tr_sharedGetPublicPort( h->shared );364 365 362 tr_sharedUnlock( h->shared ); 366 363 … … 668 665 669 666 void 670 tr_torrentChangeMyPort( tr_torrent * tor, int port ) 671 { 672 tr_torrentLock( tor ); 673 674 tor->publicPort = port; 675 667 tr_torrentChangeMyPort( tr_torrent * tor ) 668 { 676 669 if( tor->tracker ) 677 670 tr_trackerChangeMyPort( tor->tracker ); 678 679 tr_torrentUnlock( tor );680 671 } 681 672 -
trunk/libtransmission/tracker.c
r3117 r3119 29 29 #include "ptrarray.h" 30 30 #include "publish.h" 31 #include "shared.h" 31 32 #include "tracker.h" 32 33 #include "trevent.h" … … 772 773 tor->escaped, 773 774 tor->peer_id, 774 t orrent->publicPort,775 tr_sharedGetPublicPort( torrent->handle->shared ), 775 776 torrent->uploadedCur, 776 777 torrent->downloadedCur,
Note: See TracChangeset
for help on using the changeset viewer.