X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=const.py;h=fc5d1c0a49110071ab1825fd8b0f5b1e4654c128;hb=2852f1c4e2cc9afb3723ff04f4586e35281420fc;hp=1d904f60f5f3491c394da5b067e864cd738b0bdb;hpb=c1b5a9ab09dcbbae0e99caeb26809429a5d17ebd;p=quix0rs-apt-p2p.git diff --git a/const.py b/const.py index 1d904f6..fc5d1c0 100644 --- a/const.py +++ b/const.py @@ -1,27 +1,61 @@ +## Copyright 2002-2003 Andrew Loewenstern, All Rights Reserved +# see LICENSE.txt for license information + +""" from twisted.internet.default import SelectReactor ## twistedmatrix.com -reactor = SelectReactor(installSignalHandlers=0) +reactor = SelectReactor() + from twisted.internet import main main.installReactor(reactor) +try: + import twisted.names.client + reactor.installResolver(twisted.names.client.theResolver) +except IOError: + print "no resolv.conf!" +""" +from twisted.internet import reactor + +# magic id to use before we know a peer's id +NULL_ID = 20 * '\0' + +# Kademlia "K" constant, this should be an even number +K = 8 + +# SHA1 is 160 bits long +HASH_LENGTH = 160 + +# checkpoint every this many seconds +CHECKPOINT_INTERVAL = 60 * 15 # fifteen minutes + + +### SEARCHING/STORING # concurrent xmlrpc calls per find node/value request! -CONCURRENT_REQS = 3 +CONCURRENT_REQS = 4 + +# how many hosts to post to +STORE_REDUNDANCY = 3 + +### ROUTING TABLE STUFF # how many times in a row a node can fail to respond before it's booted from the routing table MAX_FAILURES = 3 +# never ping a node more often than this +MIN_PING_INTERVAL = 60 * 15 # fifteen minutes + +# refresh buckets that haven't been touched in this long +BUCKET_STALENESS = 60 * 60 # one hour + + +### KEY EXPIRER # time before expirer starts running -KEINITIAL_DELAY = 60 * 60 * 24 # 24 hours +KEINITIAL_DELAY = 15 # 15 seconds - to clean out old stuff in persistent db # time between expirer runs -KE_DELAY = 60 * 60 # 1 hour +KE_DELAY = 60 * 20 # 20 minutes # expire entries older than this -KE_AGE = KEINITIAL_DELAY - -# never ping a node more often than this -MIN_PING_INTERVAL = 60 * 15 # fifteen minutes - -# refresh buckets that haven't been touched in this long -BUCKET_STALENESS = 60 # one hour +KE_AGE = 60 * 60 # 60 minutes