[spp] [PATCH 4/5] controller: change msg format in ConnectionThread
ogawa.yasufumi at lab.ntt.co.jp
ogawa.yasufumi at lab.ntt.co.jp
Mon Oct 1 05:14:12 CEST 2018
From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
ConnectionThread is a message broker between primary and controller.
To apply with the change of primary's message format, it is change
to send JSON messages to controller.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
src/controller/conn_thread.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/controller/conn_thread.py b/src/controller/conn_thread.py
index 8bddfc0..ff0697e 100644
--- a/src/controller/conn_thread.py
+++ b/src/controller/conn_thread.py
@@ -29,7 +29,7 @@ class ConnectionThread(threading.Thread):
self.stop_event.set()
def run(self):
- cmd_str = 'hello'
+ cmd_str = ''
# infinite loop so that function do not terminate and thread do not
# end.
@@ -238,9 +238,9 @@ class PrimaryThread(threading.Thread):
data = conn.recv(spp_common.SOCK_BUF_SIZE)
if data:
spp_common.PRIMARY2MAIN.put(
- "recv:%s:{%s}" % (str(addr), data.decode('utf-8')))
+ data.decode('utf-8').strip('\0'))
else:
- spp_common.PRIMARY2MAIN.put("closing:" + str(addr))
+ spp_common.PRIMARY2MAIN.put('{"status": "closed"}')
conn.close()
self.sock_opened = False
break
--
2.7.4
More information about the spp
mailing list