have libtransmission be in charge of checking if nat traversal is disabled when quitting

This commit is contained in:
Mitchell Livingston
2007-11-09 15:06:32 +00:00
parent ba61307266
commit b382628933
3 changed files with 9 additions and 14 deletions
+4
View File
@@ -299,6 +299,10 @@ tr_closeImpl( void * vh )
tr_rcClose( h->upload );
tr_rcClose( h->download );
tr_natTraversalEnable( h, 0 );
while( tr_handleStatus( h )->natTraversalStatus != TR_NAT_TRAVERSAL_DISABLED )
tr_wait( 100 );
tr_sharedClose( h->shared );
tr_fdClose();
-10
View File
@@ -545,19 +545,9 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fDisplayedTorrents removeAllObjects];
[fTorrents removeAllObjects];
//disable NAT traversal
tr_natTraversalEnable(fLib, 0);
//clear badge
[fBadger clearBadge];
//wait for NAT to be disabled (5 second timeout)
NSDate * startDate = [NSDate date];
#warning do this in tr_close?
while ([startDate timeIntervalSinceNow] >= -5.0 && tr_handleStatus(fLib)->natTraversalStatus != TR_NAT_TRAVERSAL_DISABLED)
usleep(100000);
//remaining calls the same as dealloc
[fInfoController release];
[fMessageController release];
+5 -4
View File
@@ -105,9 +105,10 @@
[toolbar setAllowsUserCustomization: NO];
[toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel];
[toolbar setSizeMode: NSToolbarSizeModeRegular];
[[self window] setToolbar: toolbar];
[toolbar setSelectedItemIdentifier: TOOLBAR_GENERAL];
[[self window] setToolbar: toolbar];
[toolbar release];
[self setPrefView: nil];
//set download folder
@@ -240,8 +241,8 @@
{
tr_handle_status * stat = tr_handleStatus(fHandle);
BOOL change;
if (change = (fNatStatus != stat->natTraversalStatus))
BOOL change = fNatStatus != stat->natTraversalStatus;
if (change)
{
fNatStatus = stat->natTraversalStatus;
switch (fNatStatus)