changeset 430:d9d59a245461

merge
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Oct 2012 21:51:55 +0800
parents 516bb4ef0587 (current diff) 649648020123 (diff)
children b90e9c695cfd
files
diffstat 2 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/server/dump.py	Sun Oct 14 21:46:24 2012 +0800
+++ b/server/dump.py	Sun Oct 14 21:51:55 2012 +0800
@@ -145,7 +145,11 @@
 
     while True:
         l = readline(sock)
-        print l
+	if not l:
+		print '.',
+		sys.stdout.flush()
+	else:
+		print l
 
 testcount = 0
 
--- a/server/ts.py	Sun Oct 14 21:46:24 2012 +0800
+++ b/server/ts.py	Sun Oct 14 21:51:55 2012 +0800
@@ -43,21 +43,34 @@
 
 
 def flush(sock):
-    while readline(sock):
-        pass
+    ret = []
+    while True:
+        l = readline(sock)
+        if l:
+            ret.append(l)
+        else:
+            break
+    return ret
+
+def encode_extra(extra_lines):
+    return ['extra%d=%s' % (n, l.strip()) for (n,l) in enumerate(extra_lines)]
 
 @retry()
 def fetch(sock):
-    flush(sock)
+    extra_lines = flush(sock)
     sock.send("fetch\n")
 
     crc = 0
 
     lines = []
     l = readline(sock)
+    if not l:
+        return None
+
     if l != 'START\n':
-        W("Bad expected START line '%s'\n" % str(l).rstrip('\n'))
-        return None
+        W("Bad expected START line '%s'\n" % l.rstrip('\n'))
+        extra_lines.append(l)
+        return encode_extra(extra_lines)
     crc = crc16(l, crc)
 
     while True:
@@ -70,6 +83,8 @@
 
         lines.append(l.rstrip('\n'))
 
+    lines += encode_extra(extra_lines)
+
     for d in lines:
         L("Received: %s" % d)