本文整理汇总了Python中tracker.Tracker.addAfterAnnounce方法的典型用法代码示例。如果您正苦于以下问题:Python Tracker.addAfterAnnounce方法的具体用法?Python Tracker.addAfterAnnounce怎么用?Python Tracker.addAfterAnnounce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracker.Tracker
的用法示例。
在下文中一共展示了Tracker.addAfterAnnounce方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import addAfterAnnounce [as 别名]
if __name__ == '__main__':
with open(sys.argv[1],'r') as fin:
conf = json.load(fin)
if 'logging' in conf['tracker']:
logging.config.dictConfig(conf['tracker']['logging'])
authmgr = Auth(conf['salt'])
connPool = vanilla.buildConnectionPool(psycopg2,**conf['tracker']['postgresql'])
authmgr.setConnectionPool(connPool)
httpListenIp = conf['tracker'].get('ip',DEFAULT_LISTEN_IP)
httpListenPort = conf['tracker'].get('port',DEFAULT_LISTEN_PORT)
httpPathDepth = conf.get('pathDepth',DEFAULT_PATH_DEPTH)
#Use a six hour period for flushing expired peers
redisConnPool = vanilla.buildRedisConnectionPool(**conf['redis'])
peerList = Peers(redisConnPool,60*60*6)
tracker = Tracker(authmgr,peerList,httpPathDepth)
swarmConnPool = vanilla.buildConnectionPool(psycopg2,**conf['tracker']['postgresql'])
swarm = swarm.Swarm()
swarm.setConnectionPool(swarmConnPool)
eventlet.spawn_n(swarm)
tracker.addAfterAnnounce(swarm.pushPeer)
eventlet.spawn_n(peerList)
wsgi.server(eventlet.listen((httpListenIp, httpListenPort)), tracker)