changeset 418:1603d0310dd0

try to flush
author Matt Johnston <matt@ucc.asn.au>
date Sat, 06 Oct 2012 23:58:37 +0800
parents b73ea78317dc
children a60a015732ea 649648020123
files server/ts.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/server/ts.py	Sat Oct 06 23:53:28 2012 +0800
+++ b/server/ts.py	Sat Oct 06 23:58:37 2012 +0800
@@ -42,8 +42,13 @@
     return s
 
 
+def flush(sock):
+    while readline(sock):
+        pass
+
 @retry()
 def fetch(sock):
+    flush(sock)
     sock.send("fetch\n")
 
     crc = 0
@@ -94,6 +99,7 @@
     if TESTING:
         return 99
     L("Sending btoff")
+    flush(sock)
     sock.send("btoff\n");
     # read newline
     l = readline(sock)
@@ -121,6 +127,7 @@
 
 @retry()
 def clear_meas(sock):
+    flush(sock)
     sock.send("clear\n");
     l = readline(sock)
     if l and l.rstrip() == 'cleared':