本文整理汇总了Python中BaseLib.Core.DownloadConfig.DownloadConfigInterface.set_max_speed方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadConfigInterface.set_max_speed方法的具体用法?Python DownloadConfigInterface.set_max_speed怎么用?Python DownloadConfigInterface.set_max_speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseLib.Core.DownloadConfig.DownloadConfigInterface
的用法示例。
在下文中一共展示了DownloadConfigInterface.set_max_speed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_max_speed
# 需要导入模块: from BaseLib.Core.DownloadConfig import DownloadConfigInterface [as 别名]
# 或者: from BaseLib.Core.DownloadConfig.DownloadConfigInterface import set_max_speed [as 别名]
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()