Prevent loops when relaying ApplicationsMessages
Currently, we have not developed any countermeasures to detect loops when forwarding ApplicationMessages.
I just accidentally discovered such a loop in an integration test. In SuperPeerClientIT we have clients that cannot deliver any messages (even those addressed to themselves) and, therefore, forward all messages to the super-peer. The super-peer then tries, again and again, to send the message to the client.
Possible approaches:
- We add a HopCount to the ApplicationMessage, which is decremented with each forwarding. As soon as the value reaches 0, the message is discarded.
- Each node remembers the IDs of all sent messages of the last x seconds and refuses to send a message with known ID.
/cc @6roebert