aboutsummaryrefslogtreecommitdiff
path: root/cryptech_muxd
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-11-01 15:10:51 -0400
committerPaul Selkirk <paul@psgd.org>2018-11-01 15:10:51 -0400
commite017cb67f92d68200c8a838ee6f9ec0bc68f646e (patch)
tree218d4a275416ef6b7deb4b1b6abf9d50e03d7e77 /cryptech_muxd
parente5b24f3a9bd38de249baa4b362b47b4848187c7e (diff)
Tornado 5.0 made an incompatible API change in iostream.BaseIOStream.
Found when upgrading Ubuntu to 18.10.
Diffstat (limited to 'cryptech_muxd')
-rwxr-xr-xcryptech_muxd12
1 files changed, 10 insertions, 2 deletions
diff --git a/cryptech_muxd b/cryptech_muxd
index 1aecb1e..ff40048 100755
--- a/cryptech_muxd
+++ b/cryptech_muxd
@@ -128,8 +128,16 @@ class SerialIOStream(tornado.iostream.BaseIOStream):
def write_to_fd(self, data):
return self.serial.write(data)
- def read_from_fd(self):
- return self.serial.read(self.read_chunk_size) or None
+ if tornado.version > "5":
+ # .. versionchanged:: 5.0
+ # Interface redesigned to take a buffer and return a number
+ # of bytes instead of a freshly-allocated object.
+ def read_from_fd(self, buf):
+ buf[:] = self.serial.read(len(buf))
+ return len(buf) or None
+ else:
+ def read_from_fd(self):
+ return self.serial.read(self.read_chunk_size) or None
class PFUnixServer(tornado.tcpserver.TCPServer):