mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-28 22:22:13 +03:00
Gateway -> Monitor now working
We literally weren't making use of the 'topic' in the message. Thus, so as to avoid issues with trying to mash a string topic together with a bytes (compressed) message, I've ripped that out.
This commit is contained in:
parent
8bbf4f5eb8
commit
be254e7594
@ -135,11 +135,9 @@ def push_message(parsed_message: Dict, topic: str) -> None:
|
|||||||
|
|
||||||
# Push a zlib compressed JSON representation of the message to
|
# Push a zlib compressed JSON representation of the message to
|
||||||
# announcers with schema as topic
|
# announcers with schema as topic
|
||||||
compressed_msg = zlib.compress(string_message)
|
compressed_message = zlib.compress(string_message)
|
||||||
|
|
||||||
send_message = f"{str(topic)!r} |-| {compressed_msg!r}".encode('utf8')
|
sender.send(compressed_message)
|
||||||
|
|
||||||
sender.send(send_message)
|
|
||||||
stats_collector.tally("outbound")
|
stats_collector.tally("outbound")
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,23 +210,12 @@ class Monitor(Thread):
|
|||||||
database=Settings.MONITOR_DB['database']
|
database=Settings.MONITOR_DB['database']
|
||||||
)
|
)
|
||||||
|
|
||||||
# Separate topic from message
|
|
||||||
message_split = message.split(b' |-| ')
|
|
||||||
|
|
||||||
# Handle gateway not sending topic
|
|
||||||
if len(message_split) > 1:
|
|
||||||
message = message_split[1]
|
|
||||||
else:
|
|
||||||
message = message_split[0]
|
|
||||||
|
|
||||||
print(f'message: {message}')
|
|
||||||
message_text = zlib.decompress(message)
|
message_text = zlib.decompress(message)
|
||||||
json = simplejson.loads(message_text)
|
json = simplejson.loads(message_text)
|
||||||
|
|
||||||
# Default variables
|
# Default variables
|
||||||
schema_id = json['$schemaRef']
|
schema_id = json['$schemaRef']
|
||||||
software_id = json['header']['softwareName'].encode('utf8') + ' | ' \
|
software_id = f'{json["header"]["softwareName"]} | {json["header"]["softwareVersion"]}'
|
||||||
+ json['header']['softwareVersion'].encode('utf8')
|
|
||||||
|
|
||||||
# Duplicates?
|
# Duplicates?
|
||||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user