2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

protocols/pc_rpc: add get_local_host to clients

This commit is contained in:
Sebastien Bourdeauducq 2016-04-04 19:07:08 +08:00
parent ce30045dd4
commit 69516136c4

View File

@ -132,6 +132,10 @@ class Client:
identification information of the server."""
return (self.__target_names, self.__description)
def get_local_host(self):
"""Returns the address of the local end of the connection."""
return self.__socket.getsockname()[0]
def close_rpc(self):
"""Closes the connection to the RPC server.
@ -224,6 +228,10 @@ class AsyncioClient:
selected yet."""
return self.__selected_target
def get_local_host(self):
"""Returns the address of the local end of the connection."""
return self.__writer.get_extra_info("socket").getsockname()[0]
def get_rpc_id(self):
"""Returns a tuple (target_names, description) containing the
identification information of the server."""
@ -396,6 +404,12 @@ class BestEffortClient:
return self.__do_rpc(name, args, kwargs)
return proxy
def get_selected_target(self):
raise NotImplementedError
def get_local_host(self):
raise NotImplementedError
def _format_arguments(arguments):
fmtargs = []