This commit is contained in:
Marcos Pinto 2007-07-01 03:30:46 +00:00
parent 3c4eb6201e
commit 20755b32c5
1 changed files with 9 additions and 6 deletions

View File

@ -68,9 +68,10 @@ PREF_FUNCTIONS = {
"auto_seed_ratio" : None, # no need for a function, applied constantly "auto_seed_ratio" : None, # no need for a function, applied constantly
"max_download_rate_bps" : deluge_core.set_download_rate_limit, "max_download_rate_bps" : deluge_core.set_download_rate_limit,
"max_upload_rate_bps" : deluge_core.set_upload_rate_limit, "max_upload_rate_bps" : deluge_core.set_upload_rate_limit,
"enable_dht" : None, # not a normal pref in that is is applied only on start
"use_upnp" : deluge_core.use_upnp, "use_upnp" : deluge_core.use_upnp,
"use_natpmp" : deluge_core.use_natpmp, "use_natpmp" : deluge_core.use_natpmp,
"use_utpex" : deluge_core.use_utpex "use_utpex" : deluge_core.use_utpex,
} }
STATE_MESSAGES = ( "Queued", STATE_MESSAGES = ( "Queued",
@ -212,7 +213,6 @@ class Manager:
# Apply preferences. Note that this is before any torrents are added # Apply preferences. Note that this is before any torrents are added
self.apply_prefs() self.apply_prefs()
# Set the enable_dht PREF_FUNCTION
PREF_FUNCTIONS["enable_dht"] = self.set_DHT PREF_FUNCTIONS["enable_dht"] = self.set_DHT
# Unpickle the state, or create a new one # Unpickle the state, or create a new one
@ -235,6 +235,8 @@ class Manager:
else: else:
self.state = persistent_state() self.state = persistent_state()
def quit(self): def quit(self):
# Analyze data needed for pickling, etc. # Analyze data needed for pickling, etc.
self.pre_quitting() self.pre_quitting()
@ -249,13 +251,13 @@ class Manager:
pickle.dump(self.state, output) pickle.dump(self.state, output)
output.close() output.close()
# Stop DHT, if needed
self.set_DHT(False)
# Save fastresume data # Save fastresume data
print "Saving fastresume data..." print "Saving fastresume data..."
self.save_fastresume_data() self.save_fastresume_data()
# Stop DHT, if needed
self.set_DHT(False)
# Shutdown torrent core # Shutdown torrent core
print "Quitting the core..." print "Quitting the core..."
deluge_core.quit() deluge_core.quit()
@ -777,6 +779,7 @@ class Manager:
if PREF_FUNCTIONS[pref] is not None: if PREF_FUNCTIONS[pref] is not None:
PREF_FUNCTIONS[pref](self.get_pref(pref)) PREF_FUNCTIONS[pref](self.get_pref(pref))
def set_DHT(self, start=False): def set_DHT(self, start=False):
if start == True and self.dht_running != True: if start == True and self.dht_running != True:
print "Starting DHT..." print "Starting DHT..."