The port can be now chosen at library init time, with a default of calling GetDaemonPort.
Signed-off-by: Guido Trotter <[email protected]> --- lib/confd/client.py | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/confd/client.py b/lib/confd/client.py index 83445ce..64530d3 100644 --- a/lib/confd/client.py +++ b/lib/confd/client.py @@ -65,7 +65,7 @@ class ConfdClient: through asyncore or with your own handling. """ - def __init__(self, hmac_key, peers, callback): + def __init__(self, hmac_key, peers, callback, port=None): """Constructor for ConfdClient @type hmac_key: string @@ -74,6 +74,8 @@ class ConfdClient: @param peers: list of peer nodes @type callback: f(L{ConfdUpcallPayload}) @param callback: function to call when getting answers + @type port: integer + @keyword port: confd port (default: use GetDaemonPort) """ if not isinstance(peers, list): @@ -85,9 +87,12 @@ class ConfdClient: self._hmac_key = hmac_key self._socket = ConfdAsyncUDPClient(self) self._callback = callback + self._confd_port = port self._requests = {} self._expire_requests = [] - self._confd_port = utils.GetDaemonPort(constants.CONFD) + + if self._confd_port is None: + self._confd_port = utils.GetDaemonPort(constants.CONFD) def _PackRequest(self, request, now=None): """Prepare a request to be sent on the wire. -- 1.6.3.3
