@@ -357,10 +357,6 @@ async def start(self):
357357 wallet = self .component_manager .get_component (WALLET_COMPONENT )
358358 node = self .component_manager .get_component (DHT_COMPONENT ) \
359359 if self .component_manager .has_component (DHT_COMPONENT ) else None
360- try :
361- torrent = self .component_manager .get_component (LIBTORRENT_COMPONENT ) if TorrentSession else None
362- except NameError :
363- torrent = None
364360 log .info ('Starting the file manager' )
365361 loop = asyncio .get_event_loop ()
366362 self .file_manager = FileManager (
@@ -369,7 +365,8 @@ async def start(self):
369365 self .file_manager .source_managers ['stream' ] = StreamManager (
370366 loop , self .conf , blob_manager , wallet , storage , node ,
371367 )
372- if TorrentSession and LIBTORRENT_COMPONENT not in self .conf .components_to_skip :
368+ if self .component_manager .has_component (LIBTORRENT_COMPONENT ):
369+ torrent = self .component_manager .get_component (LIBTORRENT_COMPONENT )
373370 self .file_manager .source_managers ['torrent' ] = TorrentManager (
374371 loop , self .conf , torrent , storage , self .component_manager .analytics_manager
375372 )
@@ -498,9 +495,8 @@ async def get_status(self):
498495 }
499496
500497 async def start (self ):
501- if TorrentSession :
502- self .torrent_session = TorrentSession (asyncio .get_event_loop (), None )
503- await self .torrent_session .bind () # TODO: specify host/port
498+ self .torrent_session = TorrentSession (asyncio .get_event_loop (), None )
499+ await self .torrent_session .bind () # TODO: specify host/port
504500
505501 async def stop (self ):
506502 if self .torrent_session :
0 commit comments