summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-08-03 12:01:51 +0300
committerimarom <imarom@cisco.com>2016-08-03 15:03:09 +0300
commit35ab1e1766baedee576d282c928ac37b42f66e8d (patch)
tree182f311e6822a7ccf1f8497825ad275643604394 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
parentbcc2ca1a462ac65dec74e65c81e633e4f30d7fc1 (diff)
async compressed - https://trex-tgn.cisco.com/youtrack/issue/trex-232
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
index 0f73792a..2c95844b 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
@@ -13,6 +13,7 @@ from .trex_stl_jsonrpc_client import JsonRpcClient, BatchMessage
from .utils.text_opts import *
from .trex_stl_stats import *
from .trex_stl_types import *
+from .utils.zipmsg import ZippedMsg
# basic async stats class
class CTRexAsyncStats(object):
@@ -156,7 +157,9 @@ class CTRexAsyncClient():
self.monitor = AsyncUtil()
self.connected = False
-
+
+ self.zipped = ZippedMsg()
+
# connects the async channel
def connect (self):
@@ -214,7 +217,7 @@ class CTRexAsyncClient():
# done
self.connected = False
-
+
# thread function
def _run (self):
@@ -232,10 +235,17 @@ class CTRexAsyncClient():
try:
with self.monitor:
- line = self.socket.recv_string()
+ line = self.socket.recv()
self.monitor.on_recv_msg(line)
+ # try to decomrpess
+ unzipped = self.zipped.decompress(line)
+ if unzipped:
+ line = unzipped
+
+ line = line.decode()
+
self.last_data_recv_ts = time.time()
# signal once