changeset 129:de950be796dd

log errors too
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Oct 2012 20:41:52 +0800
parents 81591bdfa92c
children 97aad4471593
files server/dump.py server/ts.py
diffstat 2 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/server/dump.py	Sat Oct 06 23:58:37 2012 +0800
+++ b/server/dump.py	Thu Oct 11 20:41:52 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	Sat Oct 06 23:58:37 2012 +0800
+++ b/server/ts.py	Thu Oct 11 20:41:52 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)