Adding connection map access.
This commit is contained in:
@@ -25,6 +25,7 @@ class Client:
|
|||||||
self.started = False
|
self.started = False
|
||||||
signal.signal(signal.SIGINT, self.exit_gracefully)
|
signal.signal(signal.SIGINT, self.exit_gracefully)
|
||||||
signal.signal(signal.SIGTERM, self.exit_gracefully)
|
signal.signal(signal.SIGTERM, self.exit_gracefully)
|
||||||
|
self.connection_map = None
|
||||||
|
|
||||||
def exit_gracefully(self, signum, frame):
|
def exit_gracefully(self, signum, frame):
|
||||||
self.stop()
|
self.stop()
|
||||||
@@ -33,10 +34,12 @@ class Client:
|
|||||||
self.started = False
|
self.started = False
|
||||||
self.clear_connections()
|
self.clear_connections()
|
||||||
self.app.stop()
|
self.app.stop()
|
||||||
|
self.connection_map = None
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.app.start(self.pe_server, self.pe_port)
|
self.app.start(self.pe_server, self.pe_port)
|
||||||
self.app.register_callsigns(self.callsign)
|
self.app.register_callsigns(self.callsign)
|
||||||
|
self.connection_map = self.app._engine._active_handler._handlers[1]._connection_map
|
||||||
self.started = True
|
self.started = True
|
||||||
|
|
||||||
def clear_connections(self):
|
def clear_connections(self):
|
||||||
@@ -78,6 +81,9 @@ class Client:
|
|||||||
return Response(msg)
|
return Response(msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
#def send_receive_callsign(self, req: Request, callsign: str, timeout: int = 300) -> Optional[Response]:
|
||||||
|
# for conn in self.connection_map
|
||||||
|
|
||||||
def single_connect_send_receive(self, dest: str, req: Request, timeout: int = 300) -> Optional[Response]:
|
def single_connect_send_receive(self, dest: str, req: Request, timeout: int = 300) -> Optional[Response]:
|
||||||
conn = self.new_connection(dest)
|
conn = self.new_connection(dest)
|
||||||
logging.debug("Waiting for connection to be ready.")
|
logging.debug("Waiting for connection to be ready.")
|
||||||
|
|||||||
Reference in New Issue
Block a user