Skip to content

Commit

Permalink
Cleaned up thread names
Browse files Browse the repository at this point in the history
  • Loading branch information
ccie18643 committed Sep 8, 2024
1 parent 8ab81d4 commit 2e7aea6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
6 changes: 4 additions & 2 deletions pytcp/subsystems/arp_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
"""
Expand Down
6 changes: 4 additions & 2 deletions pytcp/subsystems/nd_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
"""
Expand Down
16 changes: 10 additions & 6 deletions pytcp/subsystems/packet_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -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:
"""
Expand All @@ -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:
"""
Expand Down
4 changes: 2 additions & 2 deletions pytcp/subsystems/rx_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
"""
Expand Down
4 changes: 2 additions & 2 deletions pytcp/subsystems/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
"""
Expand Down
4 changes: 2 additions & 2 deletions pytcp/subsystems/tx_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
"""
Expand Down

0 comments on commit 2e7aea6

Please sign in to comment.