electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 899f4e8c99a21b0fa0336f9405f44d49396c234e
parent 0e0b40921abfe1fd4aa83a00ad4a08a57eac1a0c
Author: ThomasV <thomasv@gitorious>
Date:   Mon, 14 Nov 2011 23:06:40 +0100

Merge branch 'master' of gitorious.org:electrum/electrum

Diffstat:
Mserver/server.py | 19+++++++++++++++++--
Dsetup.py | 11-----------
2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/server/server.py b/server/server.py @@ -44,6 +44,7 @@ except: sessions = {} +sessions_last_time = {} dblock = thread.allocate_lock() @@ -322,10 +323,12 @@ def client_thread(ipaddr,conn): print time.asctime(), "session", ipaddr, session_id, addresses[0], len(addresses) + clean_sessions() sessions[session_id] = {} for a in addresses: sessions[session_id][a] = '' out = repr( (session_id, SERVER_MESSAGE) ) + sessions_last_time[session_id] = time.time() elif cmd=='poll': session_id = data @@ -334,6 +337,7 @@ def client_thread(ipaddr,conn): print "session not found", ipaddr out = repr( (-1, {})) else: + sessions_last_time[session_id] = time.time() ret = {} for addr in addresses: status = store.get_status( addr ) @@ -391,6 +395,19 @@ def memorypool_update(store): #print tx['hash'][::-1].encode('hex') store.commit() + + + +def clean_sessions(): + t = time.time() + for k,t0 in sessions_last_time.items(): + if t - t0 > 60: + print "lost session",k + sessions.pop(k) + sessions_last_time.pop(k) + + + import traceback @@ -404,8 +421,6 @@ if __name__ == '__main__': store = MyStore(args) thread.start_new_thread(listen_thread, (store,)) - #listen_thread(store) - #exit(0) while True: try: diff --git a/setup.py b/setup.py @@ -1,11 +0,0 @@ -#!/usr/bin/python -from distutils.core import setup - -setup(name = "Electrum", - version = "0.21", - description = "Lightweight Bitcoin Wallet", - author = "thomasv", - license = "GNU GPLv3", - url = "http://ecdsa/electrum", - long_description = """Lightweight Bitcoin Wallet""" -)