From 266ac2d8209e9f63170e3ff32eefb331fca53300 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sun, 11 Dec 2016 10:30:22 +0200 Subject: STL API: fix split batch to chunks - one packet not being sent Change-Id: Id2e96f2fe6a6c1bb0438198675a61f3c73d53072 Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py index fbad9f7f..51e93f5a 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py @@ -41,10 +41,9 @@ class BatchMessage(object): size = 0 new_batch = [] for msg in self.batch_list: - if size < chunk_size: - size += len(json.dumps(msg)) - new_batch.append(msg) - else: + size += len(json.dumps(msg)) + new_batch.append(msg) + if size > chunk_size: batch_json = json.dumps(new_batch) response = self.rpc_client.send_msg(batch_json) if not response: -- cgit 1.2.3-korg