]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Remove an unneeded khashmir file.
authorCameron Dale <camrdale@gmail.com>
Sun, 24 Feb 2008 01:37:44 +0000 (17:37 -0800)
committerCameron Dale <camrdale@gmail.com>
Sun, 24 Feb 2008 01:37:44 +0000 (17:37 -0800)
apt_dht_Khashmir/knet.py [deleted file]

diff --git a/apt_dht_Khashmir/knet.py b/apt_dht_Khashmir/knet.py
deleted file mode 100644 (file)
index eb9215c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-#  knet.py
-#  create a network of khashmir nodes
-# usage: knet.py <num_nodes> <start_port> <ip_address>
-
-from random import randrange
-import sys, os
-
-from twisted.internet import reactor
-
-from khashmir import Khashmir
-
-class Network:
-    def __init__(self, size=0, startport=5555, localip='127.0.0.1'):
-        self.num = size
-        self.startport = startport
-        self.localip = localip
-
-    def _done(self, val):
-        self.done = 1
-        
-    def setUp(self):
-        self.kfiles()
-        self.l = []
-        for i in range(self.num):
-            self.l.append(Khashmir('', self.startport + i, '/tmp/kh%s.db' % (self.startport + i)))
-        reactor.iterate()
-        reactor.iterate()
-        
-        for i in self.l:
-            i.addContact(self.localip, self.l[randrange(0,self.num)].port)
-            i.addContact(self.localip, self.l[randrange(0,self.num)].port)
-            i.addContact(self.localip, self.l[randrange(0,self.num)].port)
-            reactor.iterate()
-            reactor.iterate()
-            reactor.iterate() 
-            
-        for i in self.l:
-            self.done = 0
-            i.findCloseNodes(self._done)
-            while not self.done:
-                reactor.iterate()
-        for i in self.l:
-            self.done = 0
-            i.findCloseNodes(self._done)
-            while not self.done:
-                reactor.iterate()
-
-    def tearDown(self):
-        for i in self.l:
-            i.listenport.stopListening()
-        self.kfiles()
-        
-    def kfiles(self):
-        for i in range(self.startport, self.startport+self.num):
-            try:
-                os.unlink('/tmp/kh%s.db' % i)
-            except:
-                pass
-            
-        reactor.iterate()
-    
-if __name__ == "__main__":
-    n = Network(int(sys.argv[1]), int(sys.argv[2]), sys.argv[3])
-    n.setUp()
-    try:
-        reactor.run()
-    finally:
-        n.tearDown()