summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-12-10 16:09:09 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-12-11 23:58:18 +0700
commit1dcc45beff210037311d7862cdf4e1ec1cd730a5 (patch)
tree9b8b34eae4db9d1b14d4e6b097bc54a3d79b9d82 /src
parent7e9821f2891e2f222c733aa74fb020515bd4691f (diff)
trx_toolkit/ctrl_if.py: read data from socket in handle_rx()
It makes much more sense to read data from socket in handle_rx(), instead of expecting a buffer with received data from caller. Change-Id: I83479c60c54e36a2a7582714a6043090585957ae
Diffstat (limited to 'src')
-rw-r--r--src/target/trx_toolkit/ctrl_if.py6
-rwxr-xr-xsrc/target/trx_toolkit/fake_trx.py6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/target/trx_toolkit/ctrl_if.py b/src/target/trx_toolkit/ctrl_if.py
index b533746b..45bfa2b9 100644
--- a/src/target/trx_toolkit/ctrl_if.py
+++ b/src/target/trx_toolkit/ctrl_if.py
@@ -27,7 +27,11 @@ import logging as log
from udp_link import UDPLink
class CTRLInterface(UDPLink):
- def handle_rx(self, data, remote):
+ def handle_rx(self):
+ # Read data from socket
+ data, remote = self.sock.recvfrom(128)
+ data = data.decode()
+
if not self.verify_req(data):
log.error("Wrong data on CTRL interface")
return
diff --git a/src/target/trx_toolkit/fake_trx.py b/src/target/trx_toolkit/fake_trx.py
index d73b5662..95261dfe 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -112,13 +112,11 @@ class Application(ApplicationBase):
# CTRL commands from BTS
if self.bts_ctrl.sock in r_event:
- data, addr = self.bts_ctrl.sock.recvfrom(128)
- self.bts_ctrl.handle_rx(data.decode(), addr)
+ self.bts_ctrl.handle_rx()
# CTRL commands from BB
if self.bb_ctrl.sock in r_event:
- data, addr = self.bb_ctrl.sock.recvfrom(128)
- self.bb_ctrl.handle_rx(data.decode(), addr)
+ self.bb_ctrl.handle_rx()
def shutdown(self):
log.info("Shutting down...")