X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=const.py;h=4926f008690d5a3d8e4cb953f67e765e883ed0d5;hb=3b636396a5d558126f9d18ff89b3e4d5bae06079;hp=0aad77d7ab46352a2899de55f7c6196f260bb207;hpb=b142a7b2b4b8a8ddb037377b90b4fe3be9f79a47;p=quix0rs-apt-p2p.git diff --git a/const.py b/const.py index 0aad77d..4926f00 100644 --- a/const.py +++ b/const.py @@ -1,5 +1,44 @@ +from twisted.internet.default import SelectReactor ## twistedmatrix.com -from twisted.internet.default import SelectReactor reactor = SelectReactor(installSignalHandlers=0) from twisted.internet import main -main.installReactor(reactor) \ No newline at end of file +main.installReactor(reactor) + +# magic id to use before we know a peer's id +NULL_ID = 20 * '\0' + +# Kademlia "K" constant +K = 8 + +# SHA1 is 160 bits long +HASH_LENGTH = 160 + + +### SEARCHING/STORING +# concurrent xmlrpc calls per find node/value request! +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 # one hour + + +### KEY EXPIRER +# time before expirer starts running +KEINITIAL_DELAY = 15 # 15 seconds - to clean out old stuff in persistent db + +# time between expirer runs +KE_DELAY = 60 * 60 # 1 hour + +# expire entries older than this +KE_AGE = 60 * 60 * 24 # 24 hours