Add session_started to determine if TorrentAddedEvent is from state file

This commit is contained in:
Calum Lind 2011-06-30 22:33:19 +01:00
parent ba1cc6ef1f
commit d6e619c413
1 changed files with 4 additions and 0 deletions

View File

@ -150,6 +150,9 @@ class TorrentManager(component.Component):
# Keeps track of resume data that needs to be saved to disk # Keeps track of resume data that needs to be saved to disk
self.resume_data = {} self.resume_data = {}
# Workaround to determine if TorrentAddedEvent is from state file
self.session_started = False
# Register set functions # Register set functions
self.config.register_set_function("max_connections_per_torrent", self.config.register_set_function("max_connections_per_torrent",
self.on_set_max_connections_per_torrent) self.on_set_max_connections_per_torrent)
@ -631,6 +634,7 @@ class TorrentManager(component.Component):
log.error("Torrent state file is either corrupt or incompatible! %s", e) log.error("Torrent state file is either corrupt or incompatible! %s", e)
break break
self.session_started = True
component.get("EventManager").emit(SessionStartedEvent()) component.get("EventManager").emit(SessionStartedEvent())
def save_state(self): def save_state(self):