cache commands
This commit is contained in:
parent
7dad17bb62
commit
e183e81649
|
@ -417,6 +417,27 @@ def client_thread(ipaddr,conn):
|
||||||
elif cmd =='tx':
|
elif cmd =='tx':
|
||||||
out = send_tx(data)
|
out = send_tx(data)
|
||||||
|
|
||||||
|
elif cmd =='clear_cache':
|
||||||
|
if config.get('server','password') == data:
|
||||||
|
self.tx_cache = {}
|
||||||
|
out = 'ok'
|
||||||
|
else:
|
||||||
|
out = 'wrong password'
|
||||||
|
|
||||||
|
elif cmd =='get_cache':
|
||||||
|
try:
|
||||||
|
pw, addr = data
|
||||||
|
except:
|
||||||
|
addr = None
|
||||||
|
if addr:
|
||||||
|
if config.get('server','password') == pw:
|
||||||
|
out = store.tx_cache.get(addr)
|
||||||
|
out = repr(out)
|
||||||
|
else:
|
||||||
|
out = 'wrong password'
|
||||||
|
else:
|
||||||
|
out = "error: "+ repr(data)
|
||||||
|
|
||||||
elif cmd == 'stop':
|
elif cmd == 'stop':
|
||||||
global stopping
|
global stopping
|
||||||
if config.get('server','password') == data:
|
if config.get('server','password') == data:
|
||||||
|
@ -539,6 +560,10 @@ if __name__ == '__main__':
|
||||||
request = "('peers','')#"
|
request = "('peers','')#"
|
||||||
elif cmd == 'stop':
|
elif cmd == 'stop':
|
||||||
request = "('stop','%s')#"%config.get('server','password')
|
request = "('stop','%s')#"%config.get('server','password')
|
||||||
|
elif cmd == 'clear_cache':
|
||||||
|
request = "('clear_cache','%s')#"%config.get('server','password')
|
||||||
|
elif cmd == 'get_cache':
|
||||||
|
request = "('get_cache',('%s','%s'))#"%(config.get('server','password'),sys.argv[2])
|
||||||
elif cmd == 'h':
|
elif cmd == 'h':
|
||||||
request = "('h','%s')#"%sys.argv[2]
|
request = "('h','%s')#"%sys.argv[2]
|
||||||
elif cmd == 'b':
|
elif cmd == 'b':
|
||||||
|
|
Loading…
Reference in New Issue