Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com
Cc: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Subject: [spp] [PATCH 4/5] controller: change msg format in ConnectionThread
Date: Mon,  1 Oct 2018 12:14:12 +0900	[thread overview]
Message-ID: <20181001031413.75652-5-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181001031413.75652-1-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@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@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

  parent reply	other threads:[~2018-10-01  3:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  3:14 [spp] [PATCH 0/5] Change primary status command to be detailed ogawa.yasufumi
2018-10-01  3:14 ` [spp] [PATCH 1/5] shared: change socket buffer length ogawa.yasufumi
2018-10-01  3:14 ` [spp] [PATCH 2/5] controller: " ogawa.yasufumi
2018-10-01  3:14 ` [spp] [PATCH 3/5] primary: change status command detailed ogawa.yasufumi
2018-10-01  3:14 ` ogawa.yasufumi [this message]
2018-10-01  3:14 ` [spp] [PATCH 5/5] controller: simply print primary status ogawa.yasufumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181001031413.75652-5-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).