Skip to content

PortManager__Generic sends debug messages "port is reserved/released" #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions testgres/impl/port_manager__generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import threading
import random
import typing
import logging


class PortManager__Generic(PortManager):
Expand Down Expand Up @@ -61,6 +62,7 @@ def reserve_port(self) -> int:
self._available_ports.discard(port)
assert port in self._reserved_ports
assert not (port in self._available_ports)
__class__.helper__send_debug_msg("Port {} is reserved.", port)
return port

raise PortForException("Can't select a port.")
Expand All @@ -80,4 +82,16 @@ def release_port(self, number: int) -> None:
self._reserved_ports.discard(number)
assert not (number in self._reserved_ports)
assert number in self._available_ports
__class__.helper__send_debug_msg("Port {} is released.", number)
return

@staticmethod
def helper__send_debug_msg(msg_template: str, *args) -> None:
assert msg_template is not None
assert args is not None
assert type(msg_template) == str # noqa: E721
assert type(args) == tuple # noqa: E721
assert msg_template != ""
s = "[port manager] "
s += msg_template.format(*args)
logging.debug(s)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy