aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2018-09-07 19:35:46 +0100
committerNeil Williams <neil.williams@linaro.org>2018-09-17 21:53:12 +0100
commitb0a52593421c1394658f98ffb586bb5647bd7d54 (patch)
treefa3e1d0b5993b2564e39bc11a9f846a291744f98
parentce4bd19e2a20c8341a6a282ac3eddcb709ce18d7 (diff)
Fix vland interface code so it works with python3 too2018.7.post1staging
Needed to add encode/decode logic due to underlying string type change to unicode. Would still also work with python2, if that mattered. Change-Id: If0b4852f05ddb6617a95726ee0d0f3e5b0685c9c
-rw-r--r--lava_dispatcher/protocols/vland.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lava_dispatcher/protocols/vland.py b/lava_dispatcher/protocols/vland.py
index b9d53f6c5..f73bb9f91 100644
--- a/lava_dispatcher/protocols/vland.py
+++ b/lava_dispatcher/protocols/vland.py
@@ -106,11 +106,11 @@ class VlandProtocol(Protocol):
msg_len = len(message)
try:
# send the length as 32bit hexadecimal
- ret_bytes = self.sock.send("%08X" % msg_len)
+ ret_bytes = self.sock.send(b"%08X" % msg_len)
if ret_bytes == 0:
self.logger.debug("zero bytes sent for length - connection closed?")
return False
- ret_bytes = self.sock.send(message)
+ ret_bytes = self.sock.send(message.encode())
if ret_bytes == 0:
self.logger.debug("zero bytes sent for message - connection closed?")
return False
@@ -130,7 +130,7 @@ class VlandProtocol(Protocol):
recv_count = 0
response = ''
while recv_count < msg_count:
- response += self.sock.recv(self.blocks)
+ response += self.sock.recv(self.blocks).decode()
recv_count += self.blocks
except socket.error as exc:
self.logger.exception("socket error '%d' on response", exc.errno)