From 9032edb0bd4d5c0a7efc5b170f28390cf034354c Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Fri, 29 Sep 2017 19:25:53 +0200 Subject: [PATCH] move up chain --- tools/client.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/client.py b/tools/client.py index b693e4b..5bfc9e8 100644 --- a/tools/client.py +++ b/tools/client.py @@ -17,6 +17,9 @@ class Client(object): # Required parameters self.storage = kw.pop('storage') self._chain = kw.pop('chain') + + self._ip_address = kw.pop('ip_address', None) + self.protocol = kw.pop('protocol', None) # First try to get an existing client by ID self.client_id = kw.pop('client_id', None) @@ -28,10 +31,6 @@ class Client(object): if client_data is None: raise StorageNotFound('Client not found') else: - # Next try to get an existing client by IP and protocol - self.ip_address = kw.pop('ip_address') - self.protocol = kw.pop('protocol') - client_data = self.storage.get_client( self._ip_address, self.protocol @@ -45,8 +44,6 @@ class Client(object): self.load_client(client_data) else: self.client_id = str(uuid4()) - self.ip_address = kw.pop('ip_address') - self.protocol = kw.pop('protocol') self.created = datetime.now() self.enabled = False self.last_packets = 0