tupdate session - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 2fb6e9d5703e19e53cf8582ad70dfa52819cf028 (DIR) parent e183e8164904af503b0571df3d72d8bde29b8074 (HTM) Author: ThomasV <thomasv@gitorious> Date: Thu, 8 Dec 2011 23:42:10 +0300 update session Diffstat: M server/server.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) --- (DIR) diff --git a/server/server.py b/server/server.py t@@ -361,6 +361,7 @@ def client_thread(ipaddr,conn): if cmd=='b': out = "%d"%block_number + elif cmd=='session': session_id = random_string(10) try: t@@ -370,7 +371,7 @@ def client_thread(ipaddr,conn): conn.close() return - print time.asctime(), "session", ipaddr, session_id, addresses[0] if addresses else addresses, len(addresses) + print time.asctime(), "new session", ipaddr, session_id, addresses[0] if addresses else addresses, len(addresses) sessions[session_id] = {} for a in addresses: t@@ -378,11 +379,27 @@ def client_thread(ipaddr,conn): out = repr( (session_id, config.get('server','banner').replace('\\n','\n') ) ) sessions_last_time[session_id] = time.time() + elif cmd=='update_session': + try: + session_id, addresses = ast.literal_eval(data) + except: + print "error" + conn.close() + return + + print time.asctime(), "update session", ipaddr, session_id, addresses[0] if addresses else addresses, len(addresses) + + sessions[session_id] = {} + for a in addresses: + sessions[session_id][a] = '' + out = 'ok' + sessions_last_time[session_id] = time.time() + elif cmd=='poll': session_id = data addresses = sessions.get(session_id) if addresses is None: - print time.asctime(), " Session not found", session_id, ipaddr + print time.asctime(), "session not found", session_id, ipaddr out = repr( (-1, {})) else: t1 = time.time()