def setUp(self): self.config_path = tempfile.mkdtemp() config = {} config['state_dir'] = self.config_path config['install_dir'] = os.path.join('..','..') config['torrent_collecting_dir'] = self.config_path config['peer_icon_path'] = os.path.join(self.config_path,'peer_icons') config['superpeer'] = False sqlitecachedb.init(config, self.rawserver_fatalerrorfunc) secover1 = SecureOverlay.getInstance() secover1.resetSingleton() secover2 = SecureOverlay.getInstance() secover2.resetSingleton() self.peer1 = Peer(self,1234,secover1) self.peer2 = Peer(self,5678,secover2) self.peer1.start() self.peer2.start() self.wanted = False self.wanted2 = False self.got = False self.got2 = False self.first = True print >>sys.stderr,"test: setUp: peer1 permid is",show_permid_short(self.peer1.my_permid) print >>sys.stderr,"test: setUp: peer2 permid is",show_permid_short(self.peer2.my_permid) sleep(2) # let server threads start
def setUp(self): self.config_path = tempfile.mkdtemp() config = {} config['state_dir'] = self.config_path config['install_dir'] = os.path.join('..', '..') config['peer_icon_path'] = os.path.join(self.config_path, 'peer_icons') config['superpeer'] = False sqlitecachedb.init(config, self.rawserver_fatalerrorfunc) secover1 = SecureOverlay.getInstance() secover1.resetSingleton() secover2 = SecureOverlay.getInstance() secover2.resetSingleton() self.peer1 = Peer(self, 1234, secover1) self.peer2 = Peer(self, 5678, secover2) self.peer1.start() self.peer2.start() self.wanted = False self.wanted2 = False self.got = False self.got2 = False self.first = True print >> sys.stderr, "test: setUp: peer1 permid is", show_permid_short( self.peer1.my_permid) print >> sys.stderr, "test: setUp: peer2 permid is", show_permid_short( self.peer2.my_permid) sleep(2) # let server threads start
def setUp(self): print >>sys.stderr,"test: TestOverlayThreadingBridge.setUp()" secover1 = SecureOverlay.getInstance() secover1.resetSingleton() secover2 = SecureOverlay.getInstance() secover2.resetSingleton() overbridge1 = OverlayThreadingBridge() overbridge1.register_bridge(secover1,None) overbridge2 = OverlayThreadingBridge() overbridge2.register_bridge(secover2,None) self.peer1 = Peer(self,1234,overbridge1) self.peer2 = Peer(self,5678,overbridge2) self.peer1.start() self.peer2.start() self.wanted = False self.wanted2 = False self.got = False self.got2 = False self.first = True print >>sys.stderr,"test: setUp: peer1 permid is",show_permid_short(self.peer1.my_permid) print >>sys.stderr,"test: setUp: peer2 permid is",show_permid_short(self.peer2.my_permid) time.sleep(2) # let server threads start
def __init__(self): if NatCheckMsgHandler.__single: raise RuntimeError, "NatCheckMsgHandler is singleton" NatCheckMsgHandler.__single = self self.crawler_reply_callbacks = [] self._secure_overlay = SecureOverlay.getInstance() self.crawler = Crawler.get_instance() if self.crawler.am_crawler(): self._file = open("natcheckcrawler.txt", "a") self._file.write("\n".join( ("# " + "*" * 80, strftime("%Y/%m/%d %H:%M:%S"), "# Crawler started\n"))) self._file.flush() self._file2 = open("nattraversalcrawler.txt", "a") self._file2.write("\n".join( ("# " + "*" * 80, strftime("%Y/%m/%d %H:%M:%S"), "# Crawler started\n"))) self._file2.flush() self.peerlist = [] self.holePunchingIP = socket.gethostbyname(socket.gethostname()) self.trav = {} else: self._file = None
def __init__(self): if NatCheckMsgHandler.__single: raise RuntimeError, "NatCheckMsgHandler is singleton" NatCheckMsgHandler.__single = self self.crawler_reply_callbacks = [] self._secure_overlay = SecureOverlay.getInstance() self.crawler = Crawler.get_instance() if self.crawler.am_crawler(): self._file = open("natcheckcrawler.txt", "a") self._file.write("\n".join(("# " + "*" * 80, strftime("%Y/%m/%d %H:%M:%S"), "# Crawler started\n"))) self._file.flush() self._file2 = open("nattraversalcrawler.txt", "a") self._file2.write("\n".join(("# " + "*" * 80, strftime("%Y/%m/%d %H:%M:%S"), "# Crawler started\n"))) self._file2.flush() self.peerlist = [] self.holePunchingIP = socket.gethostbyname(socket.gethostname()) self.trav = {} else: self._file = None