]> git.mxchange.org Git - quix0rs-apt-p2p.git/blob - const.py
b91996a7813ce085fe5940321ae0a74aa9db98e2
[quix0rs-apt-p2p.git] / const.py
1 ## Copyright 2002-2003 Andrew Loewenstern, All Rights Reserved
2 # see LICENSE.txt for license information
3
4 from twisted.internet.default import SelectReactor ## twistedmatrix.com
5
6 reactor = SelectReactor()
7
8 from twisted.internet import main
9 main.installReactor(reactor)
10
11
12 try:
13     import twisted.names.client
14     reactor.installResolver(twisted.names.client.theResolver)
15 except IOError:
16     print "no resolv.conf!"
17
18 # magic id to use before we know a peer's id
19 NULL_ID =  20 * '\0'
20
21 # Kademlia "K" constant, this should be an even number
22 K = 8
23
24 # SHA1 is 160 bits long
25 HASH_LENGTH = 160
26
27 # checkpoint every this many seconds
28 CHECKPOINT_INTERVAL = 60 * 15 # fifteen minutes
29
30
31 ### SEARCHING/STORING
32 # concurrent xmlrpc calls per find node/value request!
33 CONCURRENT_REQS = 4
34
35 # how many hosts to post to
36 STORE_REDUNDANCY = 3
37
38
39 ###  ROUTING TABLE STUFF
40 # how many times in a row a node can fail to respond before it's booted from the routing table
41 MAX_FAILURES = 3
42
43 # never ping a node more often than this
44 MIN_PING_INTERVAL = 60 * 15 # fifteen minutes
45
46 # refresh buckets that haven't been touched in this long
47 BUCKET_STALENESS = 60 # one hour
48
49
50 ###  KEY EXPIRER
51 # time before expirer starts running
52 KEINITIAL_DELAY = 15 # 15 seconds - to clean out old stuff in persistent db
53
54 # time between expirer runs
55 KE_DELAY = 60 * 60 # 1 hour
56
57 # expire entries older than this
58 KE_AGE = 60 * 60 * 24 # 24 hours