From 7bdc8eacf14ff0bca9f99ae14302fd94aa7c4ce1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 27 Mar 2009 02:26:22 +0000 Subject: Significant simplification of the packet-getter interface. packet_get() now always returns nonzero when it could either read fresh data or assemble a packet from data already read and buffered -- no more returning 0 when it has assembled a packet from buffered data but can't read any new data. I suspect this may have been causing subtle bugs. --- gpscat | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gpscat') diff --git a/gpscat b/gpscat index 457391d5..78f39914 100755 --- a/gpscat +++ b/gpscat @@ -109,8 +109,7 @@ if __name__ == '__main__': sys.stdout.write(buf) buf = "" else: - (ptype, packet) = getter.get(tty) - length = len(packet) + (length, ptype, packet) = getter.get(tty) seqno += 1 # Don't crap out if the first packet is bad, we might # be seeing an incomplete read from a tty. @@ -119,7 +118,7 @@ if __name__ == '__main__': sys.stdout.write("gpscat: terminating on bad packet\n") break elif length == 0: - continue + break if typeflag: sys.stdout.write(`ptype` + " (" + `length` + "): " + hexdump(packet)) sys.stdout.write("\n") -- cgit v1.2.1