Пример #1
0
    def subtest_download(self):
        """ Now download the file via another Session """

        self.config2 = self.config.copy()  # not really necess
        self.config_path2 = tempfile.mkdtemp()
        self.config2.set_state_dir(self.config_path2)
        self.config2.set_listen_port(self.mylistenport)
        self.session2 = Session(self.config2, ignore_singleton=True)

        # Allow session2 to start
        print >> sys.stderr, "test: downloader: Sleeping 3 secs to let Session2 start"
        time.sleep(3)

        tdef2 = TorrentDef.load(self.torrentfn)

        dscfg2 = DownloadStartupConfig()
        dscfg2.set_dest_dir(self.config_path2)
        dscfg2.set_video_event_callback(self.downloader_vod_ready_callback)

        d = self.session2.start_download(tdef2, dscfg2)
        d.set_state_callback(self.downloader_state_callback)

        time.sleep(40)
        # To test if BITFIELD is indeed wrapping around.
        self.subtest_connect2downloader()
        time.sleep(80)
Пример #2
0
 def __init__(self):
     self.peer_db = PeerDBHandler.getInstance()
     self.superpeer_db = SuperPeerDBHandler.getInstance()
     self.torrent_db = TorrentDBHandler.getInstance()
     self.mypref_db = MyPreferenceDBHandler.getInstance()
     self.pref_db = PreferenceDBHandler.getInstance()
     self.friend_db = FriendDBHandler.getInstance()
     self.listen_port = 6881
     self.session = Session()
Пример #3
0
    def setUp(self):
        """ override TestAsServer """
        # From TestAsServer.setUp(self): ignore singleton on
        self.setUpPreSession()
        self.session = Session(self.config, ignore_singleton=True)
        self.hisport = self.session.get_listen_port()
        self.setUpPostSession()

        # New code
        self.channelcastdb = ChannelCastDBHandler.getInstance()
        self.channelcastdb.registerSession(self.session)

        self.votecastdb = VoteCastDBHandler.getInstance()
        self.votecastdb.registerSession(self.session)
Пример #4
0
    def subtest_download(self):
        """ Now download the file via another Session """
        
        self.config2 = self.config.copy() # not really necess
        self.config_path2 = tempfile.mkdtemp()
        self.config2.set_state_dir(self.config_path2)
        self.config2.set_listen_port(self.mylistenport)
        self.session2 = Session(self.config2,ignore_singleton=True)
        
        # Allow session2 to start
        print >>sys.stderr,"test: Sleeping 3 secs to let Session2 start"
        time.sleep(3)
        
        tdef2 = TorrentDef.load(self.torrentfn)

        dscfg2 = DownloadStartupConfig()
        dscfg2.set_dest_dir(self.config_path2)
        
        d = self.session2.start_download(tdef2,dscfg2)
        d.set_state_callback(self.downloader_state_callback)
        time.sleep(1400)
Пример #5
0
 def setUp(self):
     """ unittest test setup code """
     self.setUpPreSession()
     self.session = Session(self.config)
     self.hisport = self.session.get_listen_port()        
     self.setUpPostSession()