Channel logging merge
This commit is contained in:
commit
c04c1abeea
101
__init__.py
101
__init__.py
@ -88,7 +88,11 @@ class callback_storage(dict):
|
|||||||
def add(self, service_id, data_id, callback, *args, **kwargs):
|
def add(self, service_id, data_id, callback, *args, **kwargs):
|
||||||
cb_data = self.get(service_id, data_id)
|
cb_data = self.get(service_id, data_id)
|
||||||
if cb_data != (None, None, None):
|
if cb_data != (None, None, None):
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.warning("Overwriting existing callback %s for service_id (%s) and data_id (%s) to %s!", repr(cb_data[0].__name__), repr(service_id), repr(data_id), repr(callback.__name__))
|
self.logger.warning("Overwriting existing callback %s for service_id (%s) and data_id (%s) to %s!", repr(cb_data[0].__name__), repr(service_id), repr(data_id), repr(callback.__name__))
|
||||||
|
=======
|
||||||
|
logger.warning("Overwriting existing callback %s for service_id (%s) and data_id (%s) to %s!" , repr(cb_data[0].__name__), repr(service_id), repr(data_id), repr(callback.__name__))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
if service_id not in self:
|
if service_id not in self:
|
||||||
self[service_id] = {}
|
self[service_id] = {}
|
||||||
self[service_id][data_id] = (callback, args, kwargs)
|
self[service_id][data_id] = (callback, args, kwargs)
|
||||||
@ -143,8 +147,11 @@ class struct_json_protocol(object):
|
|||||||
|
|
||||||
.. literalinclude:: ../../socket_protocol/_examples_/socket_protocol__struct_json_protocol_client.log
|
.. literalinclude:: ../../socket_protocol/_examples_/socket_protocol__struct_json_protocol_client.log
|
||||||
"""
|
"""
|
||||||
|
<<<<<<< HEAD
|
||||||
DEFAULT_CHANNEL_NAME = 'all_others'
|
DEFAULT_CHANNEL_NAME = 'all_others'
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
SID_AUTH_SEED_REQUEST = 1
|
SID_AUTH_SEED_REQUEST = 1
|
||||||
SID_AUTH_KEY_REQUEST = 2
|
SID_AUTH_KEY_REQUEST = 2
|
||||||
SID_AUTH_KEY_CHECK_REQUEST = 3
|
SID_AUTH_KEY_CHECK_REQUEST = 3
|
||||||
@ -196,9 +203,13 @@ class struct_json_protocol(object):
|
|||||||
self.__comm_inst__ = comm_instance
|
self.__comm_inst__ = comm_instance
|
||||||
self.__secret__ = secret
|
self.__secret__ = secret
|
||||||
self.__auto_auth__ = auto_auth
|
self.__auto_auth__ = auto_auth
|
||||||
|
<<<<<<< HEAD
|
||||||
#
|
#
|
||||||
self.__callbacks__ = callback_storage(channel_name)
|
self.__callbacks__ = callback_storage(channel_name)
|
||||||
self.__init_channel_name__(channel_name)
|
self.__init_channel_name__(channel_name)
|
||||||
|
=======
|
||||||
|
self.__channel_name__ = channel_name
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
#
|
#
|
||||||
self.__clean_receive_buffer__()
|
self.__clean_receive_buffer__()
|
||||||
self.__callbacks__.add(self.SID_AUTH_SEED_REQUEST, 0, self.__authentificate_create_seed__)
|
self.__callbacks__.add(self.SID_AUTH_SEED_REQUEST, 0, self.__authentificate_create_seed__)
|
||||||
@ -213,6 +224,7 @@ class struct_json_protocol(object):
|
|||||||
self.__comm_inst__.register_connect_callback(self.__connection_established__)
|
self.__comm_inst__.register_connect_callback(self.__connection_established__)
|
||||||
self.__comm_inst__.register_disconnect_callback(self.__authentification_state_reset__)
|
self.__comm_inst__.register_disconnect_callback(self.__authentification_state_reset__)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
def __init_channel_name__(self, channel_name):
|
def __init_channel_name__(self, channel_name):
|
||||||
self.__comm_inst__.init_channel_name(channel_name)
|
self.__comm_inst__.init_channel_name(channel_name)
|
||||||
self.__callbacks__.init_channel_name(channel_name)
|
self.__callbacks__.init_channel_name(channel_name)
|
||||||
@ -229,6 +241,14 @@ class struct_json_protocol(object):
|
|||||||
|
|
||||||
def __log_prefix__(self):
|
def __log_prefix__(self):
|
||||||
return ' SP client:' if self.__comm_inst__.IS_CLIENT else ' SP server:'
|
return ' SP client:' if self.__comm_inst__.IS_CLIENT else ' SP server:'
|
||||||
|
=======
|
||||||
|
def __log_prefix__(self):
|
||||||
|
postfix = ' (client)' if self.__comm_inst__.IS_CLIENT else ' (server)'
|
||||||
|
if self.__channel_name__ is None:
|
||||||
|
return __name__ + postfix + ':'
|
||||||
|
else:
|
||||||
|
return self.__channel_name__ + postfix + ':'
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
|
|
||||||
def connected(self):
|
def connected(self):
|
||||||
return self.__comm_inst__.is_connected()
|
return self.__comm_inst__.is_connected()
|
||||||
@ -252,22 +272,39 @@ class struct_json_protocol(object):
|
|||||||
return self.STATUS_OKAY, self.__channel_name__
|
return self.STATUS_OKAY, self.__channel_name__
|
||||||
else:
|
else:
|
||||||
prev_channel_name = self.__channel_name__
|
prev_channel_name = self.__channel_name__
|
||||||
|
<<<<<<< HEAD
|
||||||
self.__init_channel_name__(data)
|
self.__init_channel_name__(data)
|
||||||
if prev_channel_name is not None and prev_channel_name != data:
|
if prev_channel_name is not None and prev_channel_name != data:
|
||||||
self.logger.warning('%s overwriting user defined channel name from %s to %s', self.__log_prefix__(), repr(prev_channel_name), repr(data))
|
self.logger.warning('%s overwriting user defined channel name from %s to %s', self.__log_prefix__(), repr(prev_channel_name), repr(data))
|
||||||
elif prev_channel_name is None:
|
elif prev_channel_name is None:
|
||||||
self.logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
self.logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
||||||
|
=======
|
||||||
|
self.__channel_name__ = data
|
||||||
|
if prev_channel_name is not None and prev_channel_name != data:
|
||||||
|
logger.warning('%s overwriting user defined channel name from %s to %s', self.__log_prefix__(), repr(prev_channel_name), repr(data))
|
||||||
|
elif prev_channel_name is None:
|
||||||
|
logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
return self.STATUS_OKAY, None
|
return self.STATUS_OKAY, None
|
||||||
|
|
||||||
def __channel_name_response__(self, msg):
|
def __channel_name_response__(self, msg):
|
||||||
data = msg.get_data()
|
data = msg.get_data()
|
||||||
if self.__channel_name__ is None and data is not None:
|
if self.__channel_name__ is None and data is not None:
|
||||||
|
<<<<<<< HEAD
|
||||||
self.__init_channel_name__(data)
|
self.__init_channel_name__(data)
|
||||||
self.logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
self.logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
||||||
return self.STATUS_OKAY, None
|
return self.STATUS_OKAY, None
|
||||||
|
|
||||||
def __authentification_state_reset__(self):
|
def __authentification_state_reset__(self):
|
||||||
self.logger.info("%s Resetting authentification state to AUTH_STATE_UNKNOWN_CLIENT", self.__log_prefix__())
|
self.logger.info("%s Resetting authentification state to AUTH_STATE_UNKNOWN_CLIENT", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
self.__channel_name__ = data
|
||||||
|
logger.info('%s channel name is now %s', self.__log_prefix__(), repr(self.__channel_name__))
|
||||||
|
return self.STATUS_OKAY, None
|
||||||
|
|
||||||
|
def __authentification_state_reset__(self):
|
||||||
|
logger.info("%s Resetting authentification state to AUTH_STATE_UNKNOWN_CLIENT", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
||||||
|
|
||||||
def __analyse_frame__(self, frame):
|
def __analyse_frame__(self, frame):
|
||||||
@ -306,7 +343,11 @@ class struct_json_protocol(object):
|
|||||||
def __data_available_callback__(self, comm_inst):
|
def __data_available_callback__(self, comm_inst):
|
||||||
frame = comm_inst.receive()
|
frame = comm_inst.receive()
|
||||||
if not self.__check_frame_checksum__(frame):
|
if not self.__check_frame_checksum__(frame):
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.warning("%s Received message has a wrong checksum and will be ignored: %s.", self.__log_prefix__(), stringtools.hexlify(frame))
|
self.logger.warning("%s Received message has a wrong checksum and will be ignored: %s.", self.__log_prefix__(), stringtools.hexlify(frame))
|
||||||
|
=======
|
||||||
|
logger.warning("%s Received message has a wrong checksum and will be ignored: %s.", self.__log_prefix__(), stringtools.hexlify(frame))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
else:
|
else:
|
||||||
msg = self.__analyse_frame__(frame)
|
msg = self.__analyse_frame__(frame)
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
@ -325,14 +366,24 @@ class struct_json_protocol(object):
|
|||||||
if self.__secret__ is not None and not self.check_authentification_state() and msg.get_service_id() not in self.SID_AUTH_LIST:
|
if self.__secret__ is not None and not self.check_authentification_state() and msg.get_service_id() not in self.SID_AUTH_LIST:
|
||||||
status = self.STATUS_AUTH_REQUIRED
|
status = self.STATUS_AUTH_REQUIRED
|
||||||
data = None
|
data = None
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.warning("%s Received message needs authentification: %s. Sending negative response.", self.__log_prefix__(), self.AUTH_STATUS_NAMES.get(self.__authentification_state__, 'Unknown authentification status!'))
|
self.logger.warning("%s Received message needs authentification: %s. Sending negative response.", self.__log_prefix__(), self.AUTH_STATUS_NAMES.get(self.__authentification_state__, 'Unknown authentification status!'))
|
||||||
elif callback is None:
|
elif callback is None:
|
||||||
self.logger.warning("%s Received message with no registered callback. Sending negative response.", self.__log_prefix__())
|
self.logger.warning("%s Received message with no registered callback. Sending negative response.", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.warning("%s Received message needs authentification: %s. Sending negative response.", self.__log_prefix__(), self.AUTH_STATUS_NAMES.get(self.__authentification_state__, 'Unknown authentification status!'))
|
||||||
|
elif callback is None:
|
||||||
|
logger.warning("%s Received message with no registered callback. Sending negative response.", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
status = self.STATUS_BUFFERING_UNHANDLED_REQUEST
|
status = self.STATUS_BUFFERING_UNHANDLED_REQUEST
|
||||||
data = None
|
data = None
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
||||||
|
=======
|
||||||
|
logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
status, data = callback(msg, *args, **kwargs)
|
status, data = callback(msg, *args, **kwargs)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise TypeError('Check return value of callback function {callback_name} for service_id {service_id} and data_id {data_id}'.format(callback_name=callback.__name__, service_id=repr(msg.get_service_id()), data_id=repr(msg.get_data_id())))
|
raise TypeError('Check return value of callback function {callback_name} for service_id {service_id} and data_id {data_id}'.format(callback_name=callback.__name__, service_id=repr(msg.get_service_id()), data_id=repr(msg.get_data_id())))
|
||||||
@ -342,14 +393,22 @@ class struct_json_protocol(object):
|
|||||||
# RESPONSE RECEIVED
|
# RESPONSE RECEIVED
|
||||||
#
|
#
|
||||||
if msg.get_status() not in [self.STATUS_OKAY]:
|
if msg.get_status() not in [self.STATUS_OKAY]:
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.warning("%s Received message has a peculiar status: %s", self.__log_prefix__(), self.STATUS_NAMES.get(msg.get_status(), 'Unknown status response!'))
|
self.logger.warning("%s Received message has a peculiar status: %s", self.__log_prefix__(), self.STATUS_NAMES.get(msg.get_status(), 'Unknown status response!'))
|
||||||
|
=======
|
||||||
|
logger.warning("%s Received message has a peculiar status: %s", self.__log_prefix__(), self.STATUS_NAMES.get(msg.get_status(), 'Unknown status response!'))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
if callback is None:
|
if callback is None:
|
||||||
status = self.STATUS_OKAY
|
status = self.STATUS_OKAY
|
||||||
data = None
|
data = None
|
||||||
self.__buffer_received_data__(msg)
|
self.__buffer_received_data__(msg)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
||||||
|
=======
|
||||||
|
logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
status, data = callback(msg, *args, **kwargs)
|
status, data = callback(msg, *args, **kwargs)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise TypeError('Check return value of callback function {callback_name} for service_id {service_id} and data_id {data_id}'.format(callback_name=callback.__name__, service_id=repr(msg.get_service_id()), data_id=repr(msg.get_data_id())))
|
raise TypeError('Check return value of callback function {callback_name} for service_id {service_id} and data_id {data_id}'.format(callback_name=callback.__name__, service_id=repr(msg.get_service_id()), data_id=repr(msg.get_data_id())))
|
||||||
@ -360,10 +419,17 @@ class struct_json_protocol(object):
|
|||||||
if not msg.get_data_id() in self.__msg_buffer__[msg.get_service_id()]:
|
if not msg.get_data_id() in self.__msg_buffer__[msg.get_service_id()]:
|
||||||
self.__msg_buffer__[msg.get_service_id()][msg.get_data_id()] = []
|
self.__msg_buffer__[msg.get_service_id()][msg.get_data_id()] = []
|
||||||
self.__msg_buffer__[msg.get_service_id()][msg.get_data_id()].append(msg)
|
self.__msg_buffer__[msg.get_service_id()][msg.get_data_id()].append(msg)
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.debug("%s Message data is stored in buffer and is now ready to be retrieved by receive method", self.__log_prefix__())
|
self.logger.debug("%s Message data is stored in buffer and is now ready to be retrieved by receive method", self.__log_prefix__())
|
||||||
|
|
||||||
def __clean_receive_buffer__(self):
|
def __clean_receive_buffer__(self):
|
||||||
self.logger.debug("%s Cleaning up receive-buffer", self.__log_prefix__())
|
self.logger.debug("%s Cleaning up receive-buffer", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.debug("%s Message data is stored in buffer and is now ready to be retrieved by receive method", self.__log_prefix__())
|
||||||
|
|
||||||
|
def __clean_receive_buffer__(self):
|
||||||
|
logger.debug("%s Cleaning up receive-buffer", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
self.__msg_buffer__ = {}
|
self.__msg_buffer__ = {}
|
||||||
|
|
||||||
def receive(self, service_id, data_id, timeout=1):
|
def receive(self, service_id, data_id, timeout=1):
|
||||||
@ -377,7 +443,11 @@ class struct_json_protocol(object):
|
|||||||
cnt += 1
|
cnt += 1
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
if data is None and cnt >= timeout * 10:
|
if data is None and cnt >= timeout * 10:
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.warning('%s TIMEOUT (%ss): Requested data (service_id: %s; data_id: %s) not in buffer.', self.__log_prefix__(), repr(timeout), repr(service_id), repr(data_id))
|
self.logger.warning('%s TIMEOUT (%ss): Requested data (service_id: %s; data_id: %s) not in buffer.', self.__log_prefix__(), repr(timeout), repr(service_id), repr(data_id))
|
||||||
|
=======
|
||||||
|
logger.warning('%s TIMEOUT (%ss): Requested data (service_id: %s; data_id: %s) not in buffer.', self.__log_prefix__(), repr(timeout), repr(service_id), repr(data_id))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def __mk_msg__(self, status, service_id, data_id, data):
|
def __mk_msg__(self, status, service_id, data_id, data):
|
||||||
@ -402,7 +472,11 @@ class struct_json_protocol(object):
|
|||||||
|
|
||||||
This methods sends out a message with the given content.
|
This methods sends out a message with the given content.
|
||||||
"""
|
"""
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.log(log_lvl, '%s TX -> status: %d, service_id: %d, data_id: %d, data: "%s"', self.__log_prefix__(), status, service_id, data_id, repr(data))
|
self.logger.log(log_lvl, '%s TX -> status: %d, service_id: %d, data_id: %d, data: "%s"', self.__log_prefix__(), status, service_id, data_id, repr(data))
|
||||||
|
=======
|
||||||
|
logger.log(log_lvl, '%s TX -> status: %d, service_id: %d, data_id: %d, data: "%s"', self.__log_prefix__(), status, service_id, data_id, repr(data))
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
return self.__comm_inst__.send(self.__build_frame__(service_id, data_id, data, status), timeout=timeout, log_lvl=logging.DEBUG)
|
return self.__comm_inst__.send(self.__build_frame__(service_id, data_id, data, status), timeout=timeout, log_lvl=logging.DEBUG)
|
||||||
|
|
||||||
def register_callback(self, service_id, data_id, callback, *args, **kwargs):
|
def register_callback(self, service_id, data_id, callback, *args, **kwargs):
|
||||||
@ -446,7 +520,11 @@ class struct_json_protocol(object):
|
|||||||
"""
|
"""
|
||||||
if self.__secret__ is not None:
|
if self.__secret__ is not None:
|
||||||
self.__authentification_state__ = self.AUTH_STATE_SEED_REQUESTED
|
self.__authentification_state__ = self.AUTH_STATE_SEED_REQUESTED
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.info("%s Requesting seed for authentification", self.__log_prefix__())
|
self.logger.info("%s Requesting seed for authentification", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.info("%s Requesting seed for authentification", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
self.send(self.SID_AUTH_SEED_REQUEST, 0, None)
|
self.send(self.SID_AUTH_SEED_REQUEST, 0, None)
|
||||||
cnt = 0
|
cnt = 0
|
||||||
while cnt < timeout * 10:
|
while cnt < timeout * 10:
|
||||||
@ -472,7 +550,11 @@ class struct_json_protocol(object):
|
|||||||
return hashlib.sha512(seed.encode('utf-8') + self.__secret__.encode('utf-8')).hexdigest()
|
return hashlib.sha512(seed.encode('utf-8') + self.__secret__.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
def __authentificate_create_seed__(self, msg):
|
def __authentificate_create_seed__(self, msg):
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.info("%s Got seed request, sending seed for authentification", self.__log_prefix__())
|
self.logger.info("%s Got seed request, sending seed for authentification", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.info("%s Got seed request, sending seed for authentification", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
self.__authentification_state__ = self.AUTH_STATE_SEED_TRANSFERRED
|
self.__authentification_state__ = self.AUTH_STATE_SEED_TRANSFERRED
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
self.__seed__ = binascii.hexlify(os.urandom(32)).decode('utf-8')
|
self.__seed__ = binascii.hexlify(os.urandom(32)).decode('utf-8')
|
||||||
@ -481,7 +563,11 @@ class struct_json_protocol(object):
|
|||||||
return self.STATUS_OKAY, self.__seed__
|
return self.STATUS_OKAY, self.__seed__
|
||||||
|
|
||||||
def __authentificate_create_key__(self, msg):
|
def __authentificate_create_key__(self, msg):
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.info("%s Got seed, sending key for authentification", self.__log_prefix__())
|
self.logger.info("%s Got seed, sending key for authentification", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.info("%s Got seed, sending key for authentification", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
self.__authentification_state__ = self.AUTH_STATE_KEY_TRANSFERRED
|
self.__authentification_state__ = self.AUTH_STATE_KEY_TRANSFERRED
|
||||||
seed = msg.get_data()
|
seed = msg.get_data()
|
||||||
key = self.__authentificate_salt_and_hash__(seed)
|
key = self.__authentificate_salt_and_hash__(seed)
|
||||||
@ -491,21 +577,36 @@ class struct_json_protocol(object):
|
|||||||
key = msg.get_data()
|
key = msg.get_data()
|
||||||
if key == self.__authentificate_salt_and_hash__(self.__seed__):
|
if key == self.__authentificate_salt_and_hash__(self.__seed__):
|
||||||
self.__authentification_state__ = self.AUTH_STATE_TRUSTED_CLIENT
|
self.__authentification_state__ = self.AUTH_STATE_TRUSTED_CLIENT
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.info("%s Got correct key, sending positive authentification feedback", self.__log_prefix__())
|
self.logger.info("%s Got correct key, sending positive authentification feedback", self.__log_prefix__())
|
||||||
return self.STATUS_OKAY, True
|
return self.STATUS_OKAY, True
|
||||||
else:
|
else:
|
||||||
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
||||||
self.logger.info("%s Got incorrect key, sending negative authentification feedback", self.__log_prefix__())
|
self.logger.info("%s Got incorrect key, sending negative authentification feedback", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.info("%s Got correct key, sending positive authentification feedback", self.__log_prefix__())
|
||||||
|
return self.STATUS_OKAY, True
|
||||||
|
else:
|
||||||
|
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
||||||
|
logger.info("%s Got incorrect key, sending negative authentification feedback", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
return self.STATUS_OKAY, False
|
return self.STATUS_OKAY, False
|
||||||
|
|
||||||
def __authentificate_process_feedback__(self, msg):
|
def __authentificate_process_feedback__(self, msg):
|
||||||
feedback = msg.get_data()
|
feedback = msg.get_data()
|
||||||
if feedback:
|
if feedback:
|
||||||
self.__authentification_state__ = self.AUTH_STATE_TRUSTED_CLIENT
|
self.__authentification_state__ = self.AUTH_STATE_TRUSTED_CLIENT
|
||||||
|
<<<<<<< HEAD
|
||||||
self.logger.info("%s Got positive authentification feedback", self.__log_prefix__())
|
self.logger.info("%s Got positive authentification feedback", self.__log_prefix__())
|
||||||
else:
|
else:
|
||||||
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
||||||
self.logger.warning("%s Got negative authentification feedback", self.__log_prefix__())
|
self.logger.warning("%s Got negative authentification feedback", self.__log_prefix__())
|
||||||
|
=======
|
||||||
|
logger.info("%s Got positive authentification feedback", self.__log_prefix__())
|
||||||
|
else:
|
||||||
|
self.__authentification_state__ = self.AUTH_STATE_UNKNOWN_CLIENT
|
||||||
|
logger.warning("%s Got negative authentification feedback", self.__log_prefix__())
|
||||||
|
>>>>>>> 8beacaef2257e82852e1c0b5442ec4d09b891b7c
|
||||||
return self.STATUS_OKAY, None
|
return self.STATUS_OKAY, None
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user