From 2e7aea6343a5dfcc84d65792ceb3dba8c9919888 Mon Sep 17 00:00:00 2001 From: Sebastian Majewski Date: Sun, 8 Sep 2024 08:38:34 -0500 Subject: [PATCH] Cleaned up thread names --- pytcp/subsystems/arp_cache.py | 6 ++++-- pytcp/subsystems/nd_cache.py | 6 ++++-- pytcp/subsystems/packet_handler.py | 16 ++++++++++------ pytcp/subsystems/rx_ring.py | 4 ++-- pytcp/subsystems/timer.py | 4 ++-- pytcp/subsystems/tx_ring.py | 4 ++-- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/pytcp/subsystems/arp_cache.py b/pytcp/subsystems/arp_cache.py index 074fcf1c..9b574c54 100755 --- a/pytcp/subsystems/arp_cache.py +++ b/pytcp/subsystems/arp_cache.py @@ -82,7 +82,9 @@ def start(self) -> None: __debug__ and log("stack", "Starting ARP cache") self._run_thread = True - threading.Thread(target=self.__thread_maintain_cache).start() + threading.Thread( + target=self.__thread__arp_cache__maintain_entries + ).start() time.sleep(0.1) def stop(self) -> None: @@ -95,7 +97,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread_maintain_cache(self) -> None: + def __thread__arp_cache__maintain_entries(self) -> None: """ Thread responsible for maintaining ARP cache entries. """ diff --git a/pytcp/subsystems/nd_cache.py b/pytcp/subsystems/nd_cache.py index 838971ad..6b27c7e1 100755 --- a/pytcp/subsystems/nd_cache.py +++ b/pytcp/subsystems/nd_cache.py @@ -82,7 +82,9 @@ def start(self) -> None: __debug__ and log("stack", "Starting IPv6 ND cache") self._run_thread = True - threading.Thread(target=self.__thread_maintain_cache).start() + threading.Thread( + target=self.__thread__nd_cache__maintain_entries + ).start() time.sleep(0.1) def stop(self) -> None: @@ -95,7 +97,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread_maintain_cache(self) -> None: + def __thread__nd_cache__maintain_entries(self) -> None: """ Method responsible for maintaining ND cache entries. """ diff --git a/pytcp/subsystems/packet_handler.py b/pytcp/subsystems/packet_handler.py index 26df9de0..65d9ef47 100755 --- a/pytcp/subsystems/packet_handler.py +++ b/pytcp/subsystems/packet_handler.py @@ -209,7 +209,7 @@ def start(self) -> None: __debug__ and log("stack", "Starting packet handler") self._run_thread = True - threading.Thread(target=self.__thread__packet_handler).start() + threading.Thread(target=self.__thread__packet_handler__receive).start() time.sleep(0.1) self._acquire_ip4_addresses() @@ -227,7 +227,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread__acquire_ip6_addresses(self) -> None: + def __thread__packet_handler__acquire_ip6_addresses(self) -> None: """ Thread to acquire the IPv6 addresses. """ @@ -241,7 +241,7 @@ def __thread__acquire_ip6_addresses(self) -> None: __debug__ and log("stack", "Finished the IPv6 address acquire thread") - def __thread__acquire_ip4_addresses(self) -> None: + def __thread__packet_handler__acquire_ip4_addresses(self) -> None: """ Thread to acquire the IPv4 addresses. """ @@ -258,7 +258,7 @@ def __thread__acquire_ip4_addresses(self) -> None: __debug__ and log("stack", "Finished the IPv4 address acquire thread") - def __thread__packet_handler(self) -> None: + def __thread__packet_handler__receive(self) -> None: """ Thread picks up incoming packets from RX ring and processes them. """ @@ -284,7 +284,9 @@ def _acquire_ip6_addresses(self) -> None: __debug__ and log("stack", "Starting the IPv6 address acquire thread") - threading.Thread(target=self.__thread__acquire_ip6_addresses).start() + threading.Thread( + target=self.__thread__packet_handler__acquire_ip6_addresses + ).start() def _acquire_ip4_addresses(self) -> None: """ @@ -293,7 +295,9 @@ def _acquire_ip4_addresses(self) -> None: __debug__ and log("stack", "Starting the IPv4 address acquire thread") - threading.Thread(target=self.__thread__acquire_ip4_addresses).start() + threading.Thread( + target=self.__thread__packet_handler__acquire_ip4_addresses + ).start() def _assign_mac_address(self, *, mac_unicast: MacAddress) -> None: """ diff --git a/pytcp/subsystems/rx_ring.py b/pytcp/subsystems/rx_ring.py index 69366d73..208b4192 100755 --- a/pytcp/subsystems/rx_ring.py +++ b/pytcp/subsystems/rx_ring.py @@ -73,7 +73,7 @@ def start(self, *, fd: int) -> None: self._run_thread = True self._fd = fd - threading.Thread(target=self.__thread__receive).start() + threading.Thread(target=self.__thread__rx_ring__receive).start() time.sleep(0.1) def stop(self) -> None: @@ -86,7 +86,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread__receive(self) -> None: + def __thread__rx_ring__receive(self) -> None: """ Thread responsible for receiving and enqueuing incoming packets. """ diff --git a/pytcp/subsystems/timer.py b/pytcp/subsystems/timer.py index 876c8f3f..97c4ef1a 100755 --- a/pytcp/subsystems/timer.py +++ b/pytcp/subsystems/timer.py @@ -131,7 +131,7 @@ def start(self) -> None: __debug__ and log("stack", "Starting timer thread") self._run_thread = True - threading.Thread(target=self.__thread_timer).start() + threading.Thread(target=self.__thread__timer__run_tasks).start() time.sleep(0.1) def stop(self) -> None: @@ -144,7 +144,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread_timer(self) -> None: + def __thread__timer__run_tasks(self) -> None: """ Thread responsible for executing register methods on every timer tick. """ diff --git a/pytcp/subsystems/tx_ring.py b/pytcp/subsystems/tx_ring.py index f8cddd1d..f010e9dd 100755 --- a/pytcp/subsystems/tx_ring.py +++ b/pytcp/subsystems/tx_ring.py @@ -78,7 +78,7 @@ def start(self, *, fd: int, mtu: int) -> None: self._fd = fd self._mtu = mtu self._run_thread = True - threading.Thread(target=self.__thread_transmit).start() + threading.Thread(target=self.__thread__tx_ring__transmit).start() time.sleep(0.1) def stop(self) -> None: @@ -91,7 +91,7 @@ def stop(self) -> None: self._run_thread = False time.sleep(0.1) - def __thread_transmit(self) -> None: + def __thread__tx_ring__transmit(self) -> None: """ Dequeue packet from TX Ring and send it out. """