mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 22:01:55 +00:00
Fix ZMQWSProxy not executing filters/callbacks on nested messages
This commit is contained in:
parent
5715c57ebc
commit
ca09e868f1
@ -105,14 +105,9 @@ class TFWProxy:
|
||||
raise ValueError('Invalid TFW message format!')
|
||||
|
||||
def __call__(self, message):
|
||||
try:
|
||||
self.proxy_filters._execute_callbacks(message)
|
||||
except ValueError:
|
||||
LOG.exception('Invalid TFW message received!')
|
||||
if not self.filter_and_execute_callbacks(message):
|
||||
return
|
||||
|
||||
self.proxy_callbacks._execute_callbacks(message)
|
||||
|
||||
if message['key'] not in self.keyhandlers:
|
||||
self.to_destination(message)
|
||||
else:
|
||||
@ -122,13 +117,26 @@ class TFWProxy:
|
||||
except KeyError:
|
||||
LOG.error('Invalid "%s" message format! Ignoring.', handler.__name__)
|
||||
|
||||
def filter_and_execute_callbacks(self, message):
|
||||
try:
|
||||
self.proxy_filters._execute_callbacks(message)
|
||||
self.proxy_callbacks._execute_callbacks(message)
|
||||
return True
|
||||
except ValueError:
|
||||
LOG.exception('Invalid TFW message received!')
|
||||
return False
|
||||
|
||||
def mirror(self, message):
|
||||
message = message['data']
|
||||
if not self.filter_and_execute_callbacks(message):
|
||||
return
|
||||
LOG.debug('Mirroring message: %s', message)
|
||||
self.to_source(message)
|
||||
|
||||
def broadcast(self, message):
|
||||
message = message['data']
|
||||
if not self.filter_and_execute_callbacks(message):
|
||||
return
|
||||
LOG.debug('Broadcasting message: %s', message)
|
||||
self.to_source(message)
|
||||
self.to_destination(message)
|
||||
|
Loading…
Reference in New Issue
Block a user