diff server/ts.py @ 418:1603d0310dd0

try to flush
author Matt Johnston <matt@ucc.asn.au>
date Sat, 06 Oct 2012 23:58:37 +0800
parents 99ef51dd1f61
children de950be796dd
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':