From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id 93A9B201 for ; Mon, 1 Oct 2018 05:14:25 +0200 (CEST) Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w913EOt3024214; Mon, 1 Oct 2018 12:14:24 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 0A7EB63889A; Mon, 1 Oct 2018 12:14:24 +0900 (JST) Received: from localhost.localdomain (unknown [129.60.13.51]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id E485B638705; Mon, 1 Oct 2018 12:14:23 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com Cc: Yasufumi Ogawa Date: Mon, 1 Oct 2018 12:14:10 +0900 Message-Id: <20181001031413.75652-3-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20181001031413.75652-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20181001031413.75652-1-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 2/5] controller: change socket buffer length X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 03:14:26 -0000 From: Yasufumi Ogawa Size of message via socket might exceed 1000 if network configuration is complexed. This patch is for defining `spp_common.SOCK_BUF_SIZE` and its size to 2048. Signed-off-by: Yasufumi Ogawa --- src/controller/conn_thread.py | 10 ++++------ src/controller/spp.py | 2 +- src/controller/spp_common.py | 3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/controller/conn_thread.py b/src/controller/conn_thread.py index e524e84..8bddfc0 100644 --- a/src/controller/conn_thread.py +++ b/src/controller/conn_thread.py @@ -52,8 +52,7 @@ class ConnectionThread(threading.Thread): # Receiving from secondary try: - # 1024 stands for bytes of data to be received - data = self.conn.recv(1024) + data = self.conn.recv(spp_common.SOCK_BUF_SIZE) if data: msg = "%s" % data.decode('utf-8') spp_common.SEC2MAIN[self.client_id].put(msg) @@ -99,7 +98,7 @@ class AcceptThread(threading.Thread): except KeyError: return -1 - data = conn.recv(1024) + data = conn.recv(spp_common.SOCK_BUF_SIZE) if data is None: return -1 @@ -140,7 +139,7 @@ class AcceptThread(threading.Thread): msg = "_set_client_id %u" % free_client_id conn.send(msg.encode('utf-8')) - data = conn.recv(1024) + data = conn.recv(spp_common.SOCK_BUF_SIZE) return free_client_id @@ -236,8 +235,7 @@ class PrimaryThread(threading.Thread): # Receiving from primary try: - # 1024 stands for bytes of data to be received - data = conn.recv(1024) + data = conn.recv(spp_common.SOCK_BUF_SIZE) if data: spp_common.PRIMARY2MAIN.put( "recv:%s:{%s}" % (str(addr), data.decode('utf-8'))) diff --git a/src/controller/spp.py b/src/controller/spp.py index 57604de..80b1fab 100644 --- a/src/controller/spp.py +++ b/src/controller/spp.py @@ -24,7 +24,7 @@ class CmdRequestHandler(socketserver.BaseRequestHandler): CMD = None # contains a instance of Shell class def handle(self): - self.data = self.request.recv(1024).strip() + self.data = self.request.recv(spp_common.SOCK_BUF_SIZE).strip() cur_thread = threading.currentThread() print(cur_thread.getName()) print(self.client_address[0]) diff --git a/src/controller/spp_common.py b/src/controller/spp_common.py index 80fab76..0cac2d9 100644 --- a/src/controller/spp_common.py +++ b/src/controller/spp_common.py @@ -30,6 +30,9 @@ PRIMARY2MAIN = Queue() # Maximum num of sock queues for secondaries MAX_SECONDARY = 16 +# Should be as same as MSG_SIZE in src/shared/common.h +SOCK_BUF_SIZE = 2048 + PRIMARY = '' SECONDARY_COUNT = 0 -- 2.7.4