commit 4e2200dbdc83d5673666641ebc4905b35bf3a2a8
parent 317779f91f5c3639d1f2c6facebccbbe5ad9420b
Author: ThomasV <thomasv@gitorious>
Date: Fri, 18 Nov 2011 18:42:05 +0300
get block num in locked section
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/server.py b/server/server.py
@@ -44,7 +44,7 @@ except:
stopping = False
-
+block_number = -1
sessions = {}
sessions_last_time = {}
dblock = thread.allocate_lock()
@@ -314,8 +314,7 @@ def client_thread(ipaddr,conn):
return
if cmd=='b':
- out = "%d"%store.get_block_number(1)
-
+ out = "%d"%block_number
elif cmd=='session':
session_id = random_string(10)
try:
@@ -348,7 +347,7 @@ def client_thread(ipaddr,conn):
if last_status != status:
sessions[session_id][addr] = status
ret[addr] = status
- out = repr( (store.get_block_number(1), ret ) )
+ out = repr( (block_number, ret ) )
elif cmd == 'h':
# history
@@ -509,6 +508,7 @@ if __name__ == '__main__':
dblock.acquire()
store.catch_up()
memorypool_update(store)
+ block_number = store.get_block_number(1)
dblock.release()
except:
traceback.print_exc(file=sys.stdout)