Describe the bug
Higher layer packets that pass through the broadcast service on the way up to the corresponding layer are not properly processed. This makes it impossible for the receiving layer to demultiplex the packet.
Reproducing the error
Steps to reproduce the behavior:
- Create a broadcast message, say from the application layer.
- Send it down to the necessary layers, do some multiplexing and send it down to the broadcast service.
- In the broadcast service do the necessary multiplexing.
- Send down for onward delivery to recipient.
- The receiving node will send the received packet up to the necessary layers and trigger the senddown broadcast once again.
- The senddown broadcast expects an event from the on_message_from_buttom module, but it gets a payload.
- Therefore, the next node the receives this forwarded broadcast will receive a broadcast message encapsulated in another broadcast message, which it sends to the corresponding upper layer.
- The receiving layer receives a broadcast message encapsulated in another broadcast message instead of one, resulting in an error.
- Decapsulating the two will not solve the problem, because there can be further rebroadcasts, from the same node.
Expected behavior
The broadcast service when forwarding a broadcast message should only forward the message without further encapsulation. Or decapsulate the message and send it once again. So that a higher level layer receiving a broadcast message can be able to access the payload meant for it after a single decapsulation.
Modules
The issue above is related to the following modules in the Broadcasting.py file
senddownbroadcast()
on_message_from_bottom()
Desktop (please complete the following information):
- OS: Mac OS Catalina
- Python version 3.9
Additional context
The senddownbroadcast() function expects an event with the necessary payload to forward. Therefore, replacing
self.senddownbroadcast(eventobj, eventobj.eventcontent.header.messagefrom, eventobj.eventcontent.header.sequencenumber)
with
event = Event(self, BroadcastingEventTypes.BROADCAST, payload)
self.senddownbroadcast(event, eventobj.eventcontent.header.messagefrom, eventobj.eventcontent.header.sequencenumber)
should solve the problem.
Even though sending the payload as below seems feasible, it doesn't work because senddownbroadcast() expects an event.
self.senddownbroadcast(eventobj.eventcontent, eventobj.eventcontent.header.messagefrom, eventobj.eventcontent.header.sequencenumber)