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