From 6be8105e20b22e8eb538a3904b1e16d6caf11592 Mon Sep 17 00:00:00 2001 From: Marko Mecina <marko.mecina@univie.ac.at> Date: Fri, 15 Sep 2023 18:16:20 +0200 Subject: [PATCH] ignore data received on TC port for TM data rate calculation --- Ccs/poolview_sql.py | 4 ++-- Ccs/pus_datapool.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Ccs/poolview_sql.py b/Ccs/poolview_sql.py index 116485e..00ceff0 100644 --- a/Ccs/poolview_sql.py +++ b/Ccs/poolview_sql.py @@ -3321,10 +3321,10 @@ class TMPoolView(Gtk.Window): instance = 1 try: pmgr = cfl.dbus_connection('poolmanager', instance) - trashbytes, tc_data_rate, data_rate = pmgr.Functions('calc_data_rate', self.active_pool_info.filename, refresh_rate) + trashbytes, tc_data_rate, data_rate, tc_rx_bytes = pmgr.Functions('calc_data_rate', self.active_pool_info.filename, refresh_rate) self.statusbar.push(0, 'Trash: {:d} B | TC: {:7.3f} KiB/s | TM: {:7.3f} KiB/s'.format( trashbytes, tc_data_rate/1024, data_rate/1024)) - self.statusbar.set_tooltip_text('TC: {:7.3f} kbps | TM: {:7.3f} kbps'.format(tc_data_rate/1000*8, data_rate/1000*8)) + self.statusbar.set_tooltip_text('TCRX: {:d} B | TC: {:7.3f} kbps | TM: {:7.3f} kbps'.format(tc_rx_bytes, tc_data_rate/1000*8, data_rate/1000*8)) except Exception as err: self.logger.debug(err) diff --git a/Ccs/pus_datapool.py b/Ccs/pus_datapool.py index 558c954..af08b64 100644 --- a/Ccs/pus_datapool.py +++ b/Ccs/pus_datapool.py @@ -132,6 +132,7 @@ class DatapoolManager: self.pool_rows = {} # entries in MySQL "tm_pool" table self.databuflen = 0 self.tc_databuflen = 0 + self.tc_databuflen_rx = 0 # counts the received bytes on the TC connection, if drop_rx=True self.trashbytes = {None: 0} self.state = {} self.filtered_pckts = {} @@ -994,7 +995,7 @@ class DatapoolManager: buf = sockfd.recv(1024) with self.lock: - self.databuflen += len(buf) + self.tc_databuflen_rx += len(buf) except socket.timeout: self.logger.debug('Socket timeout {}:{} [TC RX]'.format(host, port)) continue @@ -1552,7 +1553,7 @@ class DatapoolManager: trashbytes = 0 else: trashbytes = 0 - return [trashbytes, tc_data_rate, data_rate] + return [trashbytes, tc_data_rate, data_rate, self.tc_databuflen_rx] def spw_receiver_del_old_pool(self, pool_name, try_delete=True, delete_abandoned=True): new_session = self.session_factory_storage -- GitLab