summaryrefslogtreecommitdiff
path: root/gps.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-10-01 20:33:48 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-10-01 20:33:48 +0000
commit9c73512e68fd9b50f19d129e120362b286bdb099 (patch)
tree7245e670d2e879b96dd4daa6220d7a3f61cde6a6 /gps.py
parent22d35e1cd302b8835e297365942ad01a703ca948 (diff)
downloadgpsd-9c73512e68fd9b50f19d129e120362b286bdb099.tar.gz
This patch fixes the end-of-test flakiness in the regression tests...
...but at the cost of relying on some Python internals that could break in the future. The dependency is documented. Some regression tests had to be rebuilt, as the checkfiles were missing trailing lines due to this bug.
Diffstat (limited to 'gps.py')
-rwxr-xr-xgps.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gps.py b/gps.py
index 819428eb..b3c547e8 100755
--- a/gps.py
+++ b/gps.py
@@ -430,6 +430,15 @@ class gps(gpsdata):
def waiting(self):
"Return True if data is ready for the client."
+ # WARNING! When we're testing here is whether there's data left in
+ # sockfile.readline()'s read buffer before we look to see if
+ # there's input waiting at the socket level. The Python sockfile API
+ # doesn't expose a way to do this, so we have to rely on knowing
+ # that the read buffer is the _rbuf member and that it's a StringIO
+ # object. Ugh. This could break. But without it, we go back ro
+ # having flaky regression errors at the end of check files.
+ if len(self.sockfile._rbuf.getvalue()) > 0:
+ return True
(winput, woutput, wexceptions) = select.select((self.sock,), (), (), 0)
return winput != []