def set_max_speed(self,direct,speed):
     if DEBUG:
         print >>sys.stderr,time.asctime(),'-', "Download: set_max_speed",`self.get_def().get_metainfo()['info']['name']`,direct,speed
     #print_stack()
     
     self.dllock.acquire()
     try:
         # Don't need to throw an exception when stopped, we then just save the new value and
         # use it at (re)startup.
         if self.sd is not None:
             set_max_speed_lambda = lambda:self.sd is not None and self.sd.set_max_speed(direct,speed,None)
             self.session.lm.rawserver.add_task(set_max_speed_lambda,0)
             
         # At the moment we can't catch any errors in the engine that this 
         # causes, so just assume it always works.
         DownloadConfigInterface.set_max_speed(self,direct,speed)
     finally:
         self.dllock.release()
Beispiel #2
0
    def set_max_speed(self, direct, speed):
        if DEBUG:
            print >> sys.stderr, "Download: set_max_speed", ` self.get_def(
            ).get_metainfo()['info']['name'] `, direct, speed
        #print_stack()

        self.dllock.acquire()
        try:
            # Don't need to throw an exception when stopped, we then just save the new value and
            # use it at (re)startup.
            if self.sd is not None:
                set_max_speed_lambda = lambda: self.sd.set_max_speed(
                    direct, speed, None)
                self.session.lm.rawserver.add_task(set_max_speed_lambda, 0)

            # At the moment we can't catch any errors in the engine that this
            # causes, so just assume it always works.
            DownloadConfigInterface.set_max_speed(self, direct, speed)
        finally:
            self.dllock.release()