mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 05:26:28 +00:00
Fix issue in saving libtorrent session state
This commit is contained in:
parent
e49b7d5c23
commit
9d2b0101d6
@ -136,9 +136,12 @@ class Core(component.Component):
|
|||||||
self.__new_release = None
|
self.__new_release = None
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
log.debug("Core stopping...")
|
||||||
|
|
||||||
# Save the DHT state if necessary
|
# Save the DHT state if necessary
|
||||||
if self.config["dht"]:
|
if self.config["dht"]:
|
||||||
self.save_dht_state()
|
self.save_dht_state()
|
||||||
|
|
||||||
# Save the libtorrent session state
|
# Save the libtorrent session state
|
||||||
self.__save_session_state()
|
self.__save_session_state()
|
||||||
|
|
||||||
@ -155,8 +158,9 @@ class Core(component.Component):
|
|||||||
def __save_session_state(self):
|
def __save_session_state(self):
|
||||||
"""Saves the libtorrent session state"""
|
"""Saves the libtorrent session state"""
|
||||||
try:
|
try:
|
||||||
open(deluge.configmanager.get_config_dir("session.state"), "wb").write(
|
lt_data = open(deluge.configmanager.get_config_dir("session.state"), "wb")
|
||||||
lt.bencode(self.session.state()))
|
lt_data.write(lt.bencode(self.session.save_state()))
|
||||||
|
lt_data.close()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.warning("Failed to save lt state: %s", e)
|
log.warning("Failed to save lt state: %s", e)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user